Reputation: 2703
I´d like to add an image in a row of a ListView
, this is my code:
ListView listViewProducts = (ListView) findViewById(R.id.listViewProducts);
ImageView iconMeat = (ImageView) findViewById(R.id.iconMeat);
String[] products = getResources().getStringArray(R.array.products);
for (int itemPos = 0; itemPos < listViewProducts.getCount(); itemPos++)
{
if ( products[0].equals(listViewProducts.getItemAtPosition(itemPos)) )
{
//TODO
// In this case to add the image
}
}
Thanks
Upvotes: 0
Views: 971
Reputation: 1194
See these posts for using adapters in listview :- https://stackoverflow.com/a/8267165/2035885 http://www.ezzylearning.com/tutorial.aspx?tid=1763429&q=customizing-android-listview-items-with-custom-arrayadapter http://www.mkyong.com/android/android-listview-example/
Do following:-
Upvotes: 1