I have an activity and it is getting restarted whenever orientation changes. I have written code to prevent activity restart upon change in orientation in the manifest file as given below:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.sample.appname.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
In the above code snippet android:configChanges="orientation|keyboardHidden" is supposed to do the work for me but the activity is still getting restarted. Please let me know how to correct it.