Java Code Examples for io.realm.Realm#where()
The following examples show how to use
io.realm.Realm#where() .
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: Database.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
public <E extends RealmObject> void deleteAllExcluding(Class<E> classType, String classField, List<String> fieldsIn) { Realm realm = get(); try { realm.beginTransaction(); RealmQuery<E> query = realm.where(classType); for (String field : fieldsIn) { query.notEqualTo(classField, field); } query.findAll() .deleteAllFromRealm(); realm.commitTransaction(); } finally { if (realm != null) { realm.close(); } } }
Example 2
Source File: RealmBufferResolver.java From TimberLorry with Apache License 2.0 | 6 votes |
@Override public List<Record> fetch() { List<Record> records = new ArrayList<>(); Realm realm = null; try { realm = Realm.getInstance(realmConfig); RealmQuery<RecordObject> query = realm.where(RecordObject.class); RealmResults<RecordObject> results = query.findAll(); for (RecordObject obj : results) { records.add(new Record(Utils.forName(obj.getClassName()), obj.getBody())); } return records; } finally { if (realm != null) realm.close(); } }
Example 3
Source File: NotesFragment.java From multi-copy with Apache License 2.0 | 5 votes |
private void refreshData(){ Realm realm = Realm.getDefaultInstance(); RealmQuery<NotesModel> notesModelRealmQuery = realm.where(NotesModel.class); RealmResults<NotesModel> query = notesModelRealmQuery.findAll(); notesList.clear(); notesList.addAll(query); notesAdapter.notifyDataSetChanged(); }
Example 4
Source File: RealmBufferResolver.java From TimberLorry with Apache License 2.0 | 5 votes |
@Override public void remove(Record record) { Realm realm = null; try { realm = Realm.getInstance(realmConfig); realm.beginTransaction(); RealmQuery<RecordObject> query = realm.where(RecordObject.class); query.equalTo("className", record.getClazz().getCanonicalName()) .equalTo("body", record.getBody()).findAll().remove(0); realm.commitTransaction(); } finally { if (realm != null) realm.close(); } }
Example 5
Source File: AlarmDAO.java From sleep-cycle-alarm with GNU General Public License v3.0 | 4 votes |
public List<Alarm> getListOfAlarms() { Realm realm = RealmManager.getRealm(); RealmQuery<Alarm> query = realm.where(Alarm.class); return query.findAll(); }