This question is the sequel of my previous one : Is it safe to use ActiveRecord pattern with Realm?
Is it safe to use convenient static getters like this one ?
public static List<ItemRealm> getListByBar(String bar){
Realm realm = Realm.getDefaultInstance();
RealmResults<ItemRealm> rtn = realm.where(ItemRealm.class).equalTo("foo", bar).findAll();
//realm.close();
return rtn;
}
By the comments on my previous post, it seems I should close the realm, but if I do my item are no longer usable.
For this is a request I make very often in my code, I want to have a delegated method.
What is the recommanded way to do so ?