Sto usando . In questo, quando sto passando da LandScape a Portrait, si chiama if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
e si passa a Portrait da LandScape. Ma quando sto passando da Portrait a Land-Scape, non sta cambiando in LandScape perché chiama if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
così, non sta cambiando da LandScape a Portrait. Per favore aiuto.Come utilizzare onConfigurationChanged() e newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE in Android 2.3.3
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);
}
}
Se siete su tablet anche aggiungere '| screenSize' ad Android: configChanges –