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

后端 未结 13 1732
情话喂你
情话喂你 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:25

    public boolean isEmpty(String TableName){
    
    SQLiteDatabase database = this.getReadableDatabase();
    return (int) DatabaseUtils.queryNumEntries(database,TableName) == 0;
    }
    

提交回复
热议问题