android studio - Trying to change the color of a dialog's button after closing it once -
so created dialog in android studio. wanted button switch colors after clicked red blue , blue red.
if (btnsoundon.gettext().tostring().equals("on")) { bluebtn=false; btnsoundon.startanimation(scale1); btnsoundon.startanimation(scale2); btnsoundon.setbackgroundcolor(color.red); mp.pause(); btnsoundon.settext("off"); } else if(btnsoundon.gettext().tostring().equals("off")) { bluebtn=true; mp.start(); btnsoundon.startanimation(scale1); btnsoundon.startanimation(scale2); btnsoundon.setbackgroundcolor(color.blue); btnsoundon.settext("on"); }
after close dialog wanted remember color of button. put in creating dialog function created:
if (bluebtn) { btnsoundon.setbackgroundcolor(color.blue); } else if (!bluebtn) { btnsoundon.setbackgroundcolor(color.red); }
but reason when reopen dialog starts blue button time. cant figure out why. in advance.
Comments
Post a Comment