Я использую onConfigurationChanged()
. В этом случае, когда я переключаюсь с LandScape на Portrait, он вызывает , если (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
и переключается на Portrait из LandScape. Но когда я переключаюсь с Portrait на Land-Scape, он не меняется на LandScape, потому что он вызывает if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
, поэтому он не меняется с LandScape на Portrait.
Пожалуйста помоги.
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//int orientation = this.getResources().getConfiguration().orientation;
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
Log.d("Entered to change as Portrait ","PPPPPPPPPPPPPPPPP");
setContentView(R.layout.settings);
} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Log.d("Entered to change as LandScape ","LLLLLLLLLLLLLLLLLLLL");
setContentView(R.layout.settings);
}
}