Skip to content Skip to sidebar Skip to footer

Imageview Not Changing Image When Source Is Changed (already Using Invalidate)

I have an imageView with a set image in xml. However when I try to change the image the ImageView never displays the second image. Instead it displays a blank screen. I have tried

Solution 1:

I think the image is too large.

On some devices, instead of java.lang.OutofMemoryError being thrown, a null bitmap is returned.

Try running your code with a smaller image. If that works, you have to learn how to display bitmaps properly in Android.

(Well either way you have to)

Solution 2:

Are you setting android:background="someDrawable" in xml? Check that and remove or set it as android:src="drawable"

If setImageBitmap is not working try with setBackground(drawable)

I know this is not the perfect answer but just a workr-around.. We will find find a definite answer.

Post a Comment for "Imageview Not Changing Image When Source Is Changed (already Using Invalidate)"