Prevent screen rotation or resize from destroying activities

If the screen is rotated by default Android destroys the
activity and recreates it. This causes issues if a child and
parent are already paired, as the connection is lost.

To prevent Android from destroying the Activity, instead
invoke a configuration change on an orientation or resize.
This commit is contained in:
Branden Archer
2015-12-27 20:48:00 -05:00
parent 7f604c47ce
commit 6af9dff004

View File

@@ -18,6 +18,7 @@
<activity
android:name="protect.babymonitor.StartActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -27,16 +28,19 @@
<activity
android:name="protect.babymonitor.MonitorActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:parentActivityName="protect.babymonitor.StartActivity"
/>
<activity
android:name="protect.babymonitor.DiscoverActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:parentActivityName="protect.babymonitor.StartActivity"
/>
<activity
android:name="protect.babymonitor.ListenActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:parentActivityName="protect.babymonitor.DiscoverActivity"
/>
</application>