The
android:configChanges="screenSize|orientation|keyboardHidden">
tag has no effect. My activity always is destroyed when the device is rotated. I do not know why this is. I have added every possible flag to the above and it still has no effect. Another relevant (?) fact: this activity contains an OpenCv JavaCameraView (camera 1 under the hood).
Here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.myname.mycamera">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme">
<activity
android:name=".activities.CaptureActivity"
android:configChanges="screenSize|orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Why might this tag not be having any effect?
e: I should specify: I want to prevent my activity from being destroyed on rotation, but I do want to know when a rotation occurs and what the current orientation is.