Remove the image from a imageview Android [duplicate] Remove the image from a imageview Android [duplicate] java java

Remove the image from a imageview Android [duplicate]


I always use

imageView.setImageDrawable(null);


Try:

imageView.setImageResource(0);

This will set the image view to use no resource.


From what I've noticed, the "working" or not of certain method when clearing image depends on the method used to populate ImageView.

So if you set img.setImageBitmap(bmp) then to clear you should use img.setImageBitmap(null).When you img.setImageResource(resId) then to clear you should use img.setImageResouce(0).Etc.