pheromix
pheromix

Reputation: 19297

How to close programatically the webbrowser?

After showing the webbroser with this code :

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);

How to close it programatically ?

Upvotes: 1

Views: 75

Answers (2)

Ken Wolf
Ken Wolf

Reputation: 23269

How to close it programatically ?

You can't.

It's not under your control. A new activity has been launched and you must wait for the user to stop interacting with it (for example, when they click the back button) for control to return to your activity.

If you want fine-grained control you should probably look at embedding a WebView in your own activity or fragment, then you have full control over opening and closing it.

Upvotes: 4

alfdev
alfdev

Reputation: 1049

If you mean the Browser App, you may close it by code finding his PID and killing it but is discouraged.

Read this post

Upvotes: 1

Related Questions