I’m trying to change the background of a button when it’s clicked but also be able to change it back when it’s clicked again. What I’m trying to do is get the buttons current background and if it is (xxxxx) then change it to (yyyyy). I can’t seem to find how to get the button’s current background and compare it to one of my drawable resources.
Any help would be much appreciated.
Some pseudo code of what I’m trying to do:
if (button1.getBackground() == R.drawable.someDrawable) {
button1.setBackgroundResource(R.drawable.someOtherDrawable);
}
I think this is the right way: link