nitin1 15 Master Poster

Hi guys,
Here is the question:
I have Activity A, Activity B. Now, A --> B . Now, pressed the home button. Now, go to any image & "open with" will show my app. when pressing my app as the option, it will hit Activity A. When it will hit A, intent is handled in this activity.
At this stage, A & B are already in the stack. I want to discard all the activities except A. I have done it by restarting the activity using CLEAR_TASK intent (basically a restarter). But problem comes when my app was not opened initially (means no A or B in the stack), in that case when user goes to any image and do "open with", it will still restart the activity & it is not looking with user prespective because it will swap 2 activity when you see it.
How can we discard all the activities in android app keeping the current activity intact? Is there any way? LMK if you need more info.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.