Code

Code

Handling Orientation Changes on Android Fragment

Fragment.setRetainInstance(true);

Calling setRetainInstance(true) on a Fragment is similar to setting the android:configChanges flag on an Activity. It signals to Android that you want to continue using the same instance of the current Fragment, so all of your member variables will remain untouched. If you rotate your device when you have an Activity that is NOT using the configChanges flag and a Fragment that IS being retained, the following lifecycle methods will be called on the Fragment:

http://code.hootsuite.com/orientation-changes-on-android/