I am developing an App on 8.1.0 Android Phone. I have four Activity. The first is AskPermissionActivity
, it will close and change to the Second Activity (DeviceListActivity)
after check the permission.
When I select the item in Second Activity (DeviceListActivity)
, it will change to the Third Activity (MainInfoActivity)
.
And the screen Orientation of Third Activity (MainInfoActivity)
is landscape , and the other is portrait. like the following code in AndroidManifest:
<!-- To access Google+ APIs: -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- BT -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- GPS -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- EXTERNAL STORAGE -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_aitrix1"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".AskPermissionActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DeviceListActivity"
android:label="@string/title_activity_device_list"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".MainInfoActivity"
android:screenOrientation="landscape"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".DataSetupActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
</application>
The Third Activity (MainInfoActivity)
, it will change to the fourth Activity (DataSetupActivity)
after I click the button , and the Third Activity (MainInfoActivity)
did not close.
When I try to finish the fourth Activity (DataSetupActivity)
and back to the Third Activity (MainInfoActivity)
via called finish()
.
The screen orientation of Third Activity (MainInfoActivity)
will change to the portrait and then change to the landscape. And the onCreate
will perform 2 times.
I have reference the following link , it seem the bug.
How to prevent Screen Orientation change when Activity finishes on Android 8.1 Version Devices?
Does any method to solve this problem ? Thanks in advance.