Get last inserted value from sqlite database Android
Use
SELECT last_insert_rowid();
to get the last inserted rowid.
If you are using AUTOINCREMENT
keyword then
SELECT * from SQLITE_SEQUENCE;
will tell you the values for every table.
To get the last row from the table..
Cursor cursor = theDatabase.query(DATABASE_TABLE, columns,null, null, null, null, null);
cursor.moveToLast();
Well actually the SQLiteDatabase class has its own insert method which returns the id of the newly created row. I think this is the best way to get the new ID. You can check its documentation here.
I hope this helps.