Here\'s the problem: When I have an activity running in the background, and I switch locales, and I switch back to the application, everything updates... EXCEPT checkboxes and r
The cause of the problem is that CompoundButton.onSaveInstanceState()
calls setFreezesText(true)
and thus saves&restores the text.
A simple solution is using a subclass like this:
public class CheckBoxNoPersistentText extends CheckBox {
public CheckBoxNoPersistentText(final Context context) {
super(context);
}
public CheckBoxNoPersistentText(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public CheckBoxNoPersistentText(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void onRestoreInstanceState(final Parcelable state) {
final CharSequence text = getText(); // the text has been resolved anew
super.onRestoreInstanceState(state); // this restores the old text
setText(text); // this overwrites the restored text with the newly resolved text
}
}