2
我目前在做以下,但我不認爲這是做它的有效方法:不我將如何在Realm Android中進行大規模更新?
Realm defaultInstance = Realm.getDefaultInstance();
RealmResults<Stamp> stamps = defaultInstance.where(Stamp.class).equalTo("exerciseGuid", exerciseGuid).findAll();
if (stamps.size() > 0) {
defaultInstance.beginTransaction();
for (int i = 0; i < stamps.size(); i++) {
Stamp stamp = stamps.get(i);
stamp.setSynced(false);
stamp.setName(newName);
}
defaultInstance.commitTransaction();
}