일부 유선 문제에서 도움이 필요합니다. 나는이 코드 조각 ITEM_ID 삽입하고 ITEM_NAME의 완벽하게 잘 배열하는Android SQLite 열 값이 존재하지 않습니다.
item_id item_name
1 first
2 second
3 third
등
에 다음과 같은 sqlite가 테이블 항목이있다. 내가 할당 할 때하지만 예외 통해
을 CustomCursorAdapter하는
내가 안드로이드 초보자입니다 도와주세요 " '첫째'열이 존재하지 않습니다."
CustomCursorAdapter ca = new CustomCursorAdapter(this,
android.R.layout.simple_list_item_1, c, from, to);
필요한 열 이름을 인수로
내의 파라미터와의 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.
}