Tried it out on my Nexus S, it ignored the landscape layout completely which was a slightly different result than I was expecting since the emulator will change to landscape but not change back

Anyway, it turns out this entry in the Android manifest file is the culprit: -
android:configChanges="orientation"
This ignores the /res/layout-land directory completely and only uses the one in /res/layout only.
If you create a different XML for landscape orientation, don't use the
Code: Select all
android:configChanges="orientation"
tag for that Activity or add a new overridden event method. It's there to stop the Activity from restarting apparently, so also from reloading the XML layout which you usually do in onCreate(). Instead, onConfigurationChanged(newConfig) is called. So you can do:
Code: Select all
@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
setContentView(R.layout.main);
}
This wil reload the layout from the layout-land directory if available. Thanks for mentioning that in the "Hello, Android" book, Ed! :-/