Last active
March 24, 2016 10:34
-
-
Save alhazmy13/a0190416e45a5b6375ab to your computer and use it in GitHub Desktop.
Realm auto-increment
This file contains 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
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