我想知道下面的代码有什么问题,为什么我不能将列 #5 setText 中的 sqlite 的值设置为 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();
为什么我无法获得价值?这段代码有什么问题?