Reputation: 14694
I have a problem with navigation in an android app with FLAG_ACTIVITY_NO_HISTORY
and startActivityForResult
.
Here is an example:
I have page A and page B. I go from A to B with the FLAG_ACTIVITY_NO_HISTORY
. Then I take a picture with startActivityForResult
.
The problem is, now I get back to page A, but I want to get back to page B.
When I remove the FLAG_ACTIVITY_NO_HISTORY
I have page B in the history which I don't want to have.
How to resolve this problem?
Upvotes: 5
Views: 2210
Reputation: 24031
You are moving from
1. Page A -> Page B with flag FLAG_ACTIVITY_NO_HISTORY
2. You start another activity from Page B with startActivityForResult
Now when you come back no Page B found bcoz of the flag FLAG_ACTIVITY_NO_HISTORY
.
Now remove the flag FLAG_ACTIVITY_NO_HISTORY
from Page B
activty and when you get the callback in onActivityResult()
of your Page B
, finish()
the page B
activity.
Upvotes: 1
Reputation: 16152
It's truly depend on your code.
Hope you had try by this way.
Intent intent = new Intent(this, SomeOtherClass.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // do not keep this intent in history.
startActivity(intent);
Try it or upload your code so i can see in detail.
Upvotes: 0
Reputation: 171
Use the history, but when you come back to your page B, just call this.finish(). This activity will end. You will probably see your page B for a second (could be depend on your code, to test).
Hope this solution could help you.
Upvotes: 2