有線の問題で助けが必要です。次のような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.
}