I have a method like this:
ToggleButton toggle = ((ToggleButton)findViewById(R.id.toggle));
toggle.setTextOn("blah");
toggle.setTextOff("blahblah");
toggle.invalidate(); // doesn't work?
This methods gets called from onOptionsItemSelected
. The toggle button is inside a LinearLayout
which is inside another LinearLayout
.
I'm expecting the text to update as soon as the method is called. Rather the text on the toggle only updates after I manually press it to switch states. What am I missing here, am I using the wrong method? Why doesn't .invalidate
work?