I am implementing List view in my Activity. I am showing image in first row only. when I moves from that Activity to another Activity and press Back then this image is shown in all Row? what to do? any help will be Appreciated. Code is this. I am Retrieving image from Remote server.
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.shop_list_items_row, null);
viewHandler = new ListingViewHandler(convertView);
convertView.setTag(viewHandler);
convertView
.setBackgroundResource((position % 2) == 0 ? R.color.listViewAlternateColor1
: R.color.listViewAlternateColor2);
}
viewHandler = (ListingViewHandler) convertView.getTag();
ImageView image = viewHandler.getImage();
Bitmap a = downloadFile(imageUrl);
if (position==0) {
image.setImageBitmap(a);
}
This is normal behaviour of
ListViewAdapter, it is because,ListViewre-usesViewasconverViewfor row. So theViewfor position 0 is re-used, which is holding the image, so You have to remove that image for other postions, to do so, put anelsecondition also, to remove image for other positions, like this: