How To Setimage To Null In Android When The Xml Has Src Not Null?
I have this xml
Solution 1:
you can use imageButton.setImageResource(0)
Solution 2:
Try this..
Your setting setBackgroundResource
that's for android:background="@drawable/icon_on"
not for android:src="@drawable/icon_on"
background and src both are different use
imageButton.setImageResource(0);
EDIT
imageButton.setImageDrawable(null);
Solution 3:
The background (backgroundresource) and foreground (src) image are two different things, thus the one does not influence the other.
Remove the foreground image using:
imageButton.setImageDrawable(null);
Solution 4:
if u want to null imageview then u have to call imageButton.setImageResource(0);
BackgroundResource only null that background of image dude
Post a Comment for "How To Setimage To Null In Android When The Xml Has Src Not Null?"