Android App orientation change restarts activity
<p>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:</p>

<pre><code>&lt;application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" &gt;
    &lt;activity
        android:name="com.sample.appname.MainActivity"
        android:label="@string/app_name"
        android:configChanges="orientation|keyboardHidden"
        &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
&lt;/application&gt;
</code></pre>

<p>In the above code snippet <strong>android:configChanges="orientation|keyboardHidden"</strong> is supposed to do the work for me but the activity is still getting restarted. Please let me know how to correct it.</p>