Skip to content

Database

Shaun Henderson edited this page Aug 21, 2018 · 2 revisions

When creating a java object, it does not have a unique ID (its set to null). Don't set the ID manually, because the database will do it for us.
To get the ID, call the DatabaseHelper.create* method. This returns the ID. Then set the ID of the java object to whatever is returned by the create method.

When updating, you pass the ID of the object you want to update to the DatabaseHelper.update* method, and the object as well. The object will have different data to what's in the database (that's why we want to update). The unique ID never changes, the other data will change.

The unique ID is called _id.

Clone this wiki locally