How can I return from a browser activity to my activity that started it?
My app generates Google Map urls, then uses ACTION_VIEW to bring up the
map. The user gets his choice of Chrome, Google Maps, Browser, etc., to
execute the action. The problem is trying to get back to my main activity
with the back key. Strangely, if I use Google Maps to execute the action,
hitting the back key gets me into my Chrome web browser and backs up from
there, rather than into my starting activity. Here's my code:
Main Activity
Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(browserIntent);
MainActivityManifest
<activity
android:name="net.hilltopper.gamewatch.MainActivity"
android:label="@string/app_name" >
</activity>
"MainActivity" is kind of a misnomer, as it's actually the second activity
called. But it was the first at the beginning, and then I added an intro
video that actually became the first activity.
Still, why does setting my two flags as above not start the Google Maps,
or Chrome, or whatever activity the user chooses to complete the action,
with a clear top and no history so that the back key will return to the
caller instead of heading out into other territory?
No comments:
Post a Comment