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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -