realm-java: Cannot resolve method refresh()

I’ve been using Realm 0.91.0 version on Android. but some core method isn’t found… like refresh(), clear(), allObjects(). I welcome If you have suggestions or solutions about how to use those above methods.

Thanks in Advance 😃

Code Sample


> public Realm realm;

   public void refresh(){
        realm.refresh();
   }

   public void clearAll(){
        realm.beginTransaction();
        realm.clear();
        realm.commitTransaction();
    }

    public Boolean hasCustomers(){
        return !realm.allObjects(NewCustomer.class).isEmpty();
    }

Version of Realm and tooling

Realm version(s): 0.91.0

Android Studio version: 2.1.1

Which Android version and device: Android N preview and Nexus 4

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 29 (17 by maintainers)

Most upvoted comments

That is correct. If you need to refresh in the middle of the Looper thread, you are most likely doing something wrong.

clear was deprecated in 0.88. You should use deleteAllFromRealm() instead. allObjects was deprecated and you should use where().findAll() instead.

The last two releases have been streamlining a lot of API’s, but we don’t plan to break stuff quite as much going forward. Sorry for the confusion.