JayVDiyk JayVDiyk - 1 year ago 81
Java Question

Delete All Realm Objects During Runtime

on iOS we can easily call

to remove all objects in our Realm database.

How do we achieve the same in Android?

Answer Source

You can do this by using results- For instance, if I want to delete all Dog objects, I can do the following-

// obtain the results of a query

RealmResults<Dog> results = realm.where(Dog.class).findAll();

// All changes to data must happen in a transaction

// Delete all matches


Ref: documentation