需要幫助解決一些有線問題。我有一個SQLite表的項目,如以下Android SQLite列值不存在問題
item_id item_name
1 first
2 second
3 third
等
這段代碼被插入ITEM_ID和ITEM_NAME到陣列完全正常。但是,當我將其指定爲通過異常CustomCursorAdapter它
「列‘第一’並不存在」
,請幫助我是新手到Android。
c = db.rawQuery("select item_id as _id, item_name from items", null);
int i = 0;
c.moveToFirst();
do {
from[i] = c.getString(1);
to[i] = c.getInt(0);
Log.i("item ", to[i] + " " + from[i]);
i++;
} while (c.moveToNext());
try {
CustomCursorAdapter ca = new CustomCursorAdapter(this,
android.R.layout.simple_list_item_1, c, from, to);
getListView().setAdapter(ca);
} catch (Exception e) {
Log.e("Ex ", e.getMessage()); // exception : column 'first' does not exists.
}