Android: main GUID

I know that if I do not use the field named _id as the main key in Android, some things like CursorAdapter will not work, but should the _id column be auto-incrementing int? Can I use Guid as a key if it's called _id, and that the CursorAdapter still works?

+6
android sqlite primary-key cursor
source share
1 answer

The yellow box in the storage manual states:

Android does not impose any restrictions that go beyond the standard SQLite concept. We recommend that you include a key field for the auto-increment value, which can be used as a unique identifier to quickly find a record. This is not required for personal data, but if you are implementing a content provider, you must include a unique identifier using the BaseColumns._ID constant.

Now, when you click on BaseColumns , you will see

public static final String _ID

Unique identifier for the string.

Type: INTEGER (long)

Constant value: "_id"

So, I think the GUID will not work.

+3
source share

All Articles