Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String writeToRealm(WeatherResponse weatherResponse) {
- Realm realm = Realm.getDefaultInstance();
- realm.executeTransaction(transactionRealm -> {
- WeatherRealm weatherRealm = findInRealm(transactionRealm, weatherResponse.getName());
- if (weatherRealm == null)
- weatherRealm = transactionRealm.createObject(WeatherRealm.class, weatherResponse.getName());
- weatherRealm.setTemp(weatherResponse.getMain().getTemp());
- });
- realm.close();
- return weatherResponse.getName();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement