S.Drumble2
S.Drumble2

Reputation: 89

SQLiteDatabase, Id of inserted row

I'm a little bit confused if I insert a new row to a table by using SQLiteDatabase.insert() method and get a 1 as a result then the ID of that row is 1 and not a 0, right?

Upvotes: 0

Views: 69

Answers (2)

Zain
Zain

Reputation: 2372

The returned value is the row ID of the newly inserted row, or -1 if an error occurred

See docs here

Upvotes: 1

laalto
laalto

Reputation: 152817

Yes. It's the new row's id. Autogenerated rowids start from 1.

Upvotes: 3

Related Questions