0
我以前见过这个问题,但似乎答案可能已过时。基于sqlite字符串字段更改imageview src
我从一个微调器拉一个数值并将它作为一个字符串存储在一个sqlite数据库中。 我有一个imageview放入行XML文件。我确定创建某种适配器。
如何根据数据库中字符串的值更改imageview源?
这里是我现在拥有的。 imageview src是静态的,id位于xml布局中。
``
私人无效fillData(){
String journalId = ((resource) this.getApplication()).getjournalId();
Cursor notesCursor = mDbHelper.fetchAllPlaces(journalId);
startManagingCursor(notesCursor);
String[] from = new String[]{journalDbAdapter.KEY_JOURNAL_NAME, journalDbAdapter.KEY_PLACE
, journalDbAdapter.KEY_DATE};
int[] to = new int[]{R.id.placedetail1, R.id.placedetail2, R.id.placedetail3};
SimpleCursorAdapter notes =
new SimpleCursorAdapter(this, R.layout.placedetailrow, notesCursor, from, to);
setListAdapter(notes);
}``
我有一个附加的字段KEY_TEMP,它将有一个值,如果一个字符串(0或1或2或3)。 我想在每种情况下更改imageview src。