How can i check to see if my sqlite table has data in it?

后端 未结 13 1669
情话喂你
情话喂你 2020-12-01 13:14

EDIT, Changed the code slightly based on answers below, but still haven\'t got it working. I also added a log message to tell me if getCount was returning > 0, and i

13条回答
  •  失恋的感觉
    2020-12-01 13:48

    My way of checking was something like this:

    Cursor cursor = db.query(DbHelper.DB_NAME,DbHelper.DB_C_ID_ONLY,null,null,null,null,null);
    if(cursor.isAfterLast())
    

    I get the _id entries which in my case are auto-increment. If the DB is empty, isAfterLast for sure returns true.

提交回复
热议问题