try-with-resources
suggest changetry (Realm realm = Realm.getDefaultInstance()) {
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
//whatever Transaction that has to be done
}
});
//No need to close realm in try-with-resources
}
The try-with-resources statement can be used only from KitKat (minSdk 19).
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents