android - Testing for Resources such as Drawbles and Background -
i need see if there way can test background button
has. example, here psueduo code:
if (button background `r.drawable.black`) { button.setbackground(to r.drawable.white) }
is there way if
statement can done? know how set backgrounds, curious on test portion.
in case, believe tags useful. try this:
//when set button: btn.setbackgroundresource(r.drawable.black); btn.settag(r.drawable.black); //when re-set button: if(btn.gettag().equals(r.drawable.black)) { btn.setbackgroundresource(r.drawable.white); btn.settag(r.drawable.white); }
Comments
Post a Comment