I am a noob so forgive me if the question is very basic, still learning from a book and experimenting.
I have a bunch of image buttons in a xml file (main.xml), when my activity starts (main_act.java) i want to replace all the other imagebuttons (except for the first) with another graphic (that says “disabled” on it, how do I do that?
(It will be based on an if() condition, i figured that out… but the replacing part is whats confusing me.
Thanks!
I think you can use ID to differ them, you can assign id to any element in your XML, you can assign id using XML attribute like this:
and access the in the code like this:
with every button having ID, the you can control them in programmatic way, to change image on an image button:
You can put
yourimageresourcebitmap image in resources/drawable.