I am getting “Index 0 requested, with a size of 0” while starting application on mobile/device. I am making sure that cursor is not ‘Null’ when I am calling. I found some similar issue and tired in my scenario but don’t work.
I have this code:
SQLiteDatabase db = mDbHelper.getReadableDatabase();
Cursor resultSet=db.rawQuery("select * from NoteTable", null);
String[] values = new String[resultSet.getCount()];
if (resultSet != null && resultSet.moveToNext());
{
do {
if (resultSet != null) {
values[i] = resultSet.getString(resultSet.getColumnIndex("noteTitle"));
i++;
}
}while (resultSet.moveToNext());
resultSet.close();
}
db.close();
return values;
I am getting following exception:
09-24 15:28:23.845 25800-25800/com.example.ashv.actionbar W/System.err﹕ java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ashv.actionbar/com.example.ashv.actionbar.MyActivity}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
0 comments:
Post a Comment