Shouldn't this work just fine?
Cursor cursor = ourDatabase.rawQuery("SELECT * FROM " + DATABASE_TABLE + " WHERE " + KEY_NAME + " = \'chaman\'",, null);
I don't know but I get an error when I try to call
cursor.getString(1);
it says CursorIndexOutofBoundsException
I've created my table using
db.execSQL("CREATE VIRTUAL TABLE " + DATABASE_TABLE
+ " USING fts3 (" + KEY_ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_NAME
+ " TEXT NOT NULL, " + KEY_ADDRESS
+ " TEXT NOT NULL, " + KEY_CONTACT + " TEXT NOT NULL, "
+ KEY_BALANCE + " DOUBLE);");
& I'm sure chaman exists in my table as I can view it there in my database.
What's wrong? Please help me out. I'm stuck here for the last 1 hour. :/
A CursorIndexOutOfBoundException means you either forgot to call moveToFirst()
or you did call moveToFirst()
but you didn't check its result (i.e. the Cursor is empty)...