I have a sqlite database. I am able to query it and get a cursor with results. It populates the data well in a list view which has 1 image view and 2 text views. However the cursor result set which has 2 columns is of text. This is shown in the 2 text views. Everything till here works fine.
Now based on the value of one of the column I need to show different images in the image view in the list item. How do I do this. As of now I am using the below code. How do I modify it to get a image view changes based on the column value?
Cursor mCursor = mDbHelper.fetchAll();
startManagingCursor(mCursor);
String[] from = new String[]{"TITLE","BODY"};
int[] to = new int[]{R.id.text1,R.id.text2};
SimpleCursorAdapter listValues =
new SimpleCursorAdapter(this, R.layout.row_item, mCursor, from, to);
setListAdapter(listValues );
I got this done using code below
listValues.setViewBinder(new SimpleCursorAdapter.ViewBinder() {