How should i update a already existing value using realm DB in android?
I have been trying to update it but it is adding as a new value only not overwritting it
Realm realm = Realm.getDefaultInstance();
OrderedRealmCollection orderedRealmCollection =
realm.where(Practice.class)
.contains("key", "matchig value")
.findAll();
if(orderedRealmCollection.size()!=0){
Practice practice = orderedRealmCollection.first();
Realm.getDefaultInstance().executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
practice.setUpdate_practice_steps(""+steps);
realm.insertOrUpdate(practice);
}
});
}