I have a listview defined by the following xml. I need to toggle the image in the list during runtime when the user clicks on any row. How can I achieve this? A
Use
public void setImageResource (int resId);
method of ImageView class.
P.S. My previous answer seems incomplete, here is the whole solution:
ImageView imageView = (ImageView) this.findViewById(R.id.img);
((BitmapDrawable)imageView.getDrawable()).getBitmap().recycle();
imageView.setImageResource(R.drawable.new_image);
imageView.invalidate();