Java Code Examples for io.realm.RealmResults#clear()

The following examples show how to use io.realm.RealmResults#clear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TodoRealmManager.java    From todo-android with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteCompleted() {
    realm.beginTransaction();
    RealmResults<Todo> results = realm.where(Todo.class).equalTo("completed", true).findAll();
    results.clear();
    realm.commitTransaction();
}
 
Example 2
Source File: ExportActivity.java    From SensorDashboard with Apache License 2.0 5 votes vote down vote up
private void deleteData() {
    mRealm = Realm.getInstance(this);
    mRealm.beginTransaction();

    RealmResults<DataEntry> result = mRealm.where(DataEntry.class).findAll();
    Log.e("SensorDashboard", "rows after delete = " + result.size());

    // Delete all matches
    result.clear();

    mRealm.commitTransaction();

    result = mRealm.where(DataEntry.class).findAll();
    Log.e("SensorDashboard", "rows after delete = " + result.size());
}