При вращении экрана в андроиде активити создаётся заново. Чтобы можно было вернуться к предыдущему состоянию - предусмотрены методы:
@Override public void onSaveInstanceState(Bundle savedInstanceState) // EditTexts text savedInstanceState.putString("first_et",((EditText)findViewById(R.id.et_first)).getText().toString()); // EditTexts text savedInstanceState.putInt("first_et_v", ((EditText)findViewById(R.id.et_first)).getVisibility()); super.onSaveInstanceState(savedInstanceState); } @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); // EditTexts text ((EditText)findViewById(R.id.et_first)).setText(savedInstanceState.getString("first_et")); // EditText visibility ((EditText)findViewById(R.id.et_first)).setVisibility(savedInstanceState.getInt("first_et_v")); }
Бывает некоторые элементы экрана падают с ексепшином
IllegalArgumentException: Wrong state class
У меня такое было для ListView, помогло android:saveEnabled выставление в false у списка
Что-то ещё про RadioButton писали - может тоже пригодится:
<RadioButton ... android:saveEnabled="false" />
http://stackoverflow.com/questions/6667603/illegalargumentexception-wrong-state-class
Для TextView можно использовать:
<TextView ... android:freezesText="true" />
http://stackoverflow.com/questions/5179686/restoring-state-of-textview-after-screen-rotation