/*
1. Add "configChanges" to your activity in the manifest

<activity android:name=".Main"
                  android:label="@string/app_name"
                  android:configChanges="keyboardHidden|orientation">

2. Add onConfigurationChanged if you wish to react to changes.
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
}