当我尝试通过SimpleCursorAdapter将数据从数据库放入ListView时,会显示ListView的行,但它们是空的。
像:
[ _ __ _ __ _ ____
[ _ __ _ __ _ ____
[ _ __ _ __ _ ____
而不是:
[TEXT]
[TEXT]
[TEXT]
我的代码:
db = provider.getReadableDatabase();
String[] columns = {"_id", "Title"};
Cursor cursor = db.query(NotificationsProvider.TABLE_NAME, columns, null, null, null, null, null);
Log.d(TAG, "COUNT: "+cursor.getCount());
String[] clm = {"Title"};
int[] to = {android.R.id.list};
cursorAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1,
cursor, clm, to, 0);
setListAdapter(cursorAdapter);
谢谢!
答案 0 :(得分:1)