Remove the image from a imageview Android

ChyBy picture ChyBy · Jul 10, 2011 · Viewed 88.9k times · Source

I'm trying to make an ImageView that holds a gallery of images. By touching the user request to load the next image. If the next image isn't found in the server or takes time to load I need the old image to be empty.

setVisibility(View.GONE) or setVisibility(View.INVISIBLE) don't work for me because when invisible/gone I stop the onTouch() detecting (and the user is locked to current image).

How can I make the ImageView to load a empty bitmap or clear (remove) current bitmap?

Answer

tristan2468 picture tristan2468 · Feb 26, 2013

I always use

imageView.setImageDrawable(null);