I have a database saved in my Android application and want to retrieve the last 10 messages inserted into the DB.
When I use:
Select * from tblmessag
Try this,
SQLiteDatabase database = getReadableDatabase(); Cursor c=database.rawQuery("sql Query", null); if(c.moveToFirst) { int curSize=c.getCount() // return no of rows if(curSize>10) { int lastTenValue=curSize -10; for(int i=0;i
Then retrieve the last 10 data.