Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid multiple instances of Activity
    primarykey
    data
    text
    <p>I'm having a problem where multiple instances of an activity are present in the backstack.</p> <p>e.g. </p> <p>Stack: A > B > C Press home and use some other apps then relaunch my app Stack: A > B > C > A</p> <p>I would expect my app to resume with activity C, which in most cases it does, but occasionally it resumes with activity A and then when i press back it goes to activity C.</p> <p>I know this problem is not caused by android killing my app as if this was the case it would resume with activity A as the root.</p> <p>I have tried altering the launchMode attribute to singleTask and singleInstance but this results in activity A being resumed as the root, which is not the behaviour that i want, i want it to go back to the previously viewed activity with the backstack intact (I understand this is not always possible if the OS kills the app, which is fine).</p> <p>I dont believe setting the launchMode attribute to singleTop would be useful either as this would prevent A > A situations but not A > B > A or A > B > C > A etc</p> <p>Manifest:</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="" android:versionCode="1" android:versionName="1.0" android:installLocation="auto" &gt; &lt;application android:label="@string/app_name" android:debuggable="false" android:name="" android:icon="@drawable/icon" android:theme="@style/CustomTheme" android:targetSdkVersion="8" android:minSdkVersion="4"&gt; &lt;activity android:name=".activity.A" android:windowSoftInputMode="stateUnchanged|adjustPan" android:screenOrientation="portrait"&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;activity android:name=".activity.B" android:screenOrientation="portrait"/&gt; &lt;activity android:name=".activity.C" android:screenOrientation="portrait" /&gt; &lt;activity android:name=".activity.D" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /&gt; &lt;activity android:name=".activity.E" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /&gt; &lt;service android:name=".service.S" /&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" /&gt; &lt;supports-screens android:largeScreens="false" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p></p> <p>Any advice would be greatly appreciated</p> <p>David</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload