apatki
apatki

Reputation: 151

How to open default browser

Can we make use of default browser instead of the WebView browser Is there ny API for the default browser.....

or we have to compulsory create our own browser through WebView

Upvotes: 14

Views: 15275

Answers (4)

Pedro Lobito
Pedro Lobito

Reputation: 98861

This is a late answer but if you just need to open the default browser without an url you can use about:blank, i.e.:

Intent blankIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("about:blank"));
startActivity(blankIntent);

Tested with:

Stock Browser, Chrome, Firefox and Opera for Android

Upvotes: 1

Anas Khan
Anas Khan

Reputation: 131

You have to import intent.

String url = "http://www.google.com";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);

Upvotes: 13

Niranj Patel
Niranj Patel

Reputation: 33238

Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse(value));
startActivity(i);

value is your URL address.

Upvotes: 3

Valentin Rocher
Valentin Rocher

Reputation: 11669

You can use an Intent with ACTION_VIEW to open the browser with your URL. Would be something like that :

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));

Upvotes: 13

Related Questions