0

I have activity stack A->B->C->D... I am finishing A soon after launching B. SO the stack is actually b->C->..

Now i have a broadcast receiver which launches A. From the receiver i have to launch it as a new task. So now another task is created with stack A->B..

So now my stack will be (B->C ( from the new task) B->C->D (from prev stack)

But what i need is to have only the new task stack. ie the new stack will be just B->C

I tried using these flags also but didnt help

Intent loginIntent = new Intent(context, MyActivity.class);
        loginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        loginIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(loginIntent);
png
  • 4,368
  • 7
  • 69
  • 118

1 Answers1

0

How about setting the launchMode according to Androidmanifest.xml In your requirement, it might be set to singleTask.

Hence, in your AndroidManifest.xml, it would be like this

    <activity
        android:name=".ScrollDemoActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask">
        ...
    </activity>

Ref: http://developer.android.com/guide/components/tasks-and-back-stack.html

Edson
  • 1
  • Thanks a lot but .this is not working. I had tried this. I have edited my question – png Jun 25 '12 at 07:09