I am trying to check if a sqlite database is empty using
public boolean chkDB(){
boolean chk = false;
Cursor mCursor = db.rawQuery(\"SELECT
I know this is too late ,but i had the same error before and order to fix it change your code to:
public boolean chkDB(){
boolean chk = false;
Cursor mCursor = db.rawQuery("SELECT * FROM " + DATABASE_TABLE, null);
if (mCursor != null){
while(mCursor.moveToFirst()){
if (mCursor.getInt(0) == 0){
chk = false;
}
}else{
chk = true;
}
}
return chk;
}
You have to add while statement not if or else it will cause a IndexOutOfBound exception