I have a transparent ImageButton. When clicked, the ImageResource of the button is set to a drawable in my drawable-hdpi folder (basically an image is shown on top of the transparent ImageButton). I'm using the ImageButton.setImageResource()
method in order to do that. My question is, how can I remove the image resource so that there is only a transparent image button again. Of course, I need to be able to do this in java, not XML. I tried the following which failed to work: ImageButton.setImageResource(null);
I also looked around a bit and couldn't find an answer... Thanks in advance for any help.
EDIT: Thank you all for your answers.. Péter Varga's answer did exactly what I needed so that's what i'm going with.
Try setting imageButton.setImageResource(android.R.color.transparent)
.