Created
September 25, 2016 17:20
-
-
Save miquelbeltran/3347b05f55a145c0dd6a5d544b3315db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Realm realmUI; | |
protected void onCreate(Bundle savedInstanceState) { | |
// ... | |
realmUI = Realm.getDefaultInstance(); | |
// ... | |
} | |
private WeatherRealm readFromRealm(String name) { | |
return findInRealm(realmUI, name); | |
} | |
private WeatherRealm findInRealm(Realm realm, String name) { | |
return realm.where(WeatherRealm.class).equalTo("name", name).findFirst(); | |
} | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
realmUI.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment