onConfigurationChanged() でメソッド setContentView(R.layout.main) を呼び出します
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
///in case you have some EditTexts , save their input before setting the new layout.
emailForConfigChanges = emailTextBox.getText().toString().trim();
passwordForConfigChanges = passwordTextBox.getText().toString().trim();
setContentView(R.layout.main);
//Now set the values back to the EditTexts .
}
マニフェストで「方向」を宣言している場合は、方向のすべての変更を処理するため、このメソッドをアクティビティに追加するだけです。
EDIT :また、EditTexts が回転時に値を失った場合は、onConfigurationChanged() で setContentView() を呼び出す前に値を取得します。上記の編集を参照してください。