I want to display data from column according to another column, so I used this method in HelperDB to get the Cursor:
public Cursor getData(String EMAIL) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "SELECT * FROM table_users WHERE email LIKE '" + EMAIL +"';" , null );
return res;
}
And to display(hlp is the HlperDB):
Cursor c = hlp.getData(Email);
tv3 = (TextView) findViewById(R.id.tv3);
tv3.setText(c.getString(c.getColumnIndex(HelperDB.NOTES)));
But it gave this error: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
Can you help me please?