Skip to content

Instantly share code, notes, and snippets.

@oznus
Created August 30, 2015 22:44
Show Gist options
  • Save oznus/929f4fb69a7e87e5c212 to your computer and use it in GitHub Desktop.
Save oznus/929f4fb69a7e87e5c212 to your computer and use it in GitHub Desktop.
//Create all Retrofit stuff..
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.myserver.com")
.build();
MyService service = restAdapter.create(MyService.class);
//Fetch the user from the api
User user = service.getUser("432947");
//Save it to realm
Realm realm = Realm.getInstance(context;
realm.beginTransaction();
realm.copyToRealm(user);
realm.commitTransaction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment