My XML file contain four buttons, lets say Button A, B, C and Confirm. In my main file, when Button A is clicked, Button B will get the image background of Button A. That posts no problems. However, my problem is that I wanted that when Confirm is clicked, Button C will have another background image depending on Button B’s background image. How do I do that? To simplify, I do not know how to check the image background of Button B (which depends on Button A) and it will determine the image of Button C.
Cheers!
This will copy the background from buttonB to buttonC:
To see what background you have you can use the Views tag. Let’s use some strings to identify the backgrounds:
We set some background on buttonA that we call “BACK1”,then also call
buttonA.setTag("BACK1");When you later copy the background from A->B, also do
buttonB.setTag(buttonA.getTag());Now whenever you need to know what background buttonB have, just check the tag with smth like:
Of course you can use smth better in the tag, an resource ID so you can use a switch statement.