Reputation: 168
I have an image resource ID in an SQLite database and I would like to display this image in a list view. I have created a row template but the default image is displayed in the list. How do I update the image src?
to populate the list view, I use the following code
ListView listView = (ListView) findViewById(R.id.winnerListView);
int[] viewColumns = {R.id.winnerPositionView, R.id.winnerIcon, R.id.winnerNameView, R.id.winnerScoreView};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.result_row_layout, c, DatabaseHelper.PROJECTION, viewColumns, 0);
listView.setAdapter(adapter);
Thanks
Upvotes: 0
Views: 211
Reputation: 3259
Here having sample projects how to load image in a list view. Please go through it.
Upvotes: 0
Reputation: 8091
In ordes to do that you must have custom adapter class for list view ,using this adapter class you must set view for each row of listview
Here is some Tutorial 1 , Tutorial 2, Tutorial 3, Tutorial 4 Hope this will help you
Upvotes: 1