// AndroidManifest.xml
...
<activity
android:name=".mainActivity"
...
android:configChanges="keyboardHidden|orientation|screenSize"
...
/>
...
// mainActivity.java
@Overridea
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged( newConfig );
/*
if ( newConfig.orientation == newConfig.ORIENTATION_LANDSCAPE ) {
// Landscape
setContentView( R.layout.main_landscape );
else if ( newConfig.orientation == newConfig.ORIENTATION_PORTRAIT ) {
// portrait
setContentView( R.layout.main_portrait );
}
...
*/
// Portrait -> Landscape
if ( newConfig.orientation == newConfig.ORIENTATION_PORTRAIT ) {
// Landscape
setContentView( R.layout.main_landscape );
}
}
i hope this may help you.