Skip to content

Instantly share code, notes, and snippets.

@alhazmy13
Last active March 24, 2016 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alhazmy13/a0190416e45a5b6375ab to your computer and use it in GitHub Desktop.
Save alhazmy13/a0190416e45a5b6375ab to your computer and use it in GitHub Desktop.
Realm auto-increment
public int getNextID() {
return mRealm.allObjects(YOUR_CLASS).size() > 0 ? realm.where(YOUR_CLASS).max("id").intValue() + 1 : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment