我有一个包含 5 列的数据库,其中 1 列是 TEXT,其名称为 /res/drawable 文件夹。
private void fillData() {
mCursor = db2.getAllAchievements();
startManagingCursor(mCursor);
String[] from = new String[]{achHelper.ROW_NAME, achHelper.ROW_DESCRIPTION, achHelper.ROW_POINTS, achHelper.ROW_TROPHY};
int[] to = new int[]{R.id.achTitle, R.id.achDescription, R.id.achPoints, R.id.trophy};
SimpleCursorAdapter classes =
new SimpleCursorAdapter(this, R.layout.ach_row, mCursor, from, to);
setListAdapter(classes);
}
R.id.trophy 是一个 ImageView,如何根据从 achHelper.ROW_TROPHY 中提取的数据设置背景图像?