Im trying to get the corresponding title to the given ID using the code below
public String get_Title(int id){
Cursor c = db.query(true, DATABASE_TABLE, new String[] {
APP_TITLE,
},
KEY_ROWID + "=" + id,
null,
null,
null,
null,
null);
String Final = c.getString(0);
return Final;
}
I keep gettting exceptions caused by the index out of bounds. IM not good with cursors, so if anyone could help me out here. :S
You must before
String Final = c.getString(0)callc.moveToFirst()orc.moveToNext()and then it should works. BecauseCursoris implicitly positioned to position before first row so you must at first moveCursorto first row and then you can get data from it.EDIT:
So it should be like this:
So you wrote that you not good in work with
Cursorlittle introduction:name…
More about work with cursors you find here
Regards