在一些有线问题上需要帮助。我有一个 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.
}