0

I have an EditText that takes the color of an xml.

myr1.setTextAppearance(getApplicationContext(), R.style.myr_ok);

I know that when you rotate the screen activity is destroyed, and I managed to retrieve some data (values, status button) using onSaveInstanceState () but I can not find how to retrieve the color of the edit text (can be green or red) and keep . Is it possible with onSaveInstanceState () or I have to use another way?

1 Answers1

0

You can use getTextColors() in onSaveInstanceState to retrieve the current color state list for the TextView. Alternatively you could keep a variable remembering the resource ID of which text appearance style you last set, and save this in onSaveInstanceState

Joseph Earl
  • 23,351
  • 11
  • 76
  • 89