Я пытаюсь получить свое состояние checkedTextView из базы данных SQLite, но оно приводит к сбою приложения.
Вот реализованный код:
Cursor c = db.rawQuery("SELECT * FROM list", null);
int foundIndex = c.getColumnIndex("found");
while (c != null) {
c.getString(foundIndex);
c.moveToNext();
}
String[] foundList = new String[foundIndex];
arrayAdapter.notifyDataSetChanged();
for (String found : levelOneListList){
if (levelOneListList == foundList){
levelOneListView.setItemChecked(found.indexOf(foundIndex), true);
}
}
}
И он выдает эту ошибку:
java.lang.RuntimeException: Невозможно запустить действие ComponentInfo {com.example.woodlandwanderer / com.example.woodlandwanderer.levelOneActivity}: android.database.CursorIndexOutOfBoundsException: индекс -1 запрошен, с размером 0