次のコードの何が問題なのか疑問に思っていました.sqliteの値を列#5 setTextからTextViewに設定できないのはなぜですか?
//Adapter SQLite
public Cursor getFRUIT_LEVEL_EASY_STEP_2()
{
Cursor step_2 = sqLiteDatabase.rawQuery("SELECT count(*) FROM FRUIT WHERE " + KEY_LEVEL + "='Easy' AND " + KEY_LEVEL_STEP + "=1", null);
return step_2;
}
final TextView l1 = (TextView) findViewById(R.id.l1);
mySQLiteAdapter = new SQLiteAdapter(this);
mySQLiteAdapter.openToRead();
step_2 = mySQLiteAdapter.getFRUIT_LEVEL_EASY_STEP_2();
step_2.moveToFirst();
int count2 = step_2.getInt(0);
// Here i want to get value Int from clumns #5
int score =step_2.getInt(5);
if(count2 != 0)
{
l1.setText(Integer.toString(score));
}
step_2.close();
mySQLiteAdapter.close();
値を取得できないのはなぜですか? このコードで何が間違っていますか?