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);