I have this xml
if u want to null imageview then u have to call imageButton.setImageResource(0);
BackgroundResource only null that background of image dude
you can use imageButton.setImageResource(0)
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);
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);