I think I just discovered a really strange mistake ... But it could be some feature I have never heard of.
In my application, if I have activity on AndroidManifest with android: launchMode = "singleInstance", when you try to "clear" the stack to a specific point using the following code:
Intent intent = new Intent(this, Xpto.class); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);
This applies to this activity. But when you push back, it goes back to the previous one. It should have been finished ...
Example:
A → B → C
Then from C, I call A with Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP with one instance in the manifest. It goes to A, but it only brings it forward. And does not finish C and B.
Can someone explain this behavior?
The Xpto class that I call is the root action of the stack at that time.
source share