Cursor cur=db.rawQuery("select LAST_INSERT_ROWID() ",null); cur.moveToFirst(); int id = cur.getInt(0);