I have four activity in my tasks A,B,C,D.
Activities are launched in order A->B->C->D.
Here,
I want to go back to the activity A from D and resume that activity .
So that i used the intent flagi.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
Activities B,C,D instance are is no longer needed after the stmt 1.
i go for the flag to accomplish this,Intent.FLAG_ACTIVITY_CLEAR_TOP
In my appp using the above 1 and 2 i try to achieve like
- go back and resume the acivity A and remove the other activities from the stack
so i tried like.
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //vise versa
using the above code both flags are appened here using this reference
(Android:What is difference between setFlags and addFlags for intent)
I am not able to achieve these task combined( resume the activity A and clear other).
actual calling scenario is
when i use the CLEAR flag the call is like D->oncreate(A) and clear BCD
when i use the REORDER flag the call is like D->onrestart(A).
So how can i combine this flags to get the combined action to resume A and clear other or is there any other way to do this.
this is my manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tpv.vptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".NeverStopActivity"
android:label="@string/title_activity_main"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
activity 1->2
Intent i = new Intent(getApplicationContext(), TopMenuBar.class);
startActivity(i);
- You can perform this action again in 1 seconds - retry / cancel
activity 2->3
Intent i = new Intent(getApplicationContext(),
Activity3.class);
startActivity(i);
and 3-> 1
Intent i = new Intent(getApplicationContext(),
NeverStopActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(i);