Possible Duplicate:
How can I open a URL in Android’s web browser from my application?
I've been trying to find out how to create an intent that will open the specified URL in a Specified browser. Browser may not always be the default one. But i am unable to do so.
To open a URL/website you do the following: String url = "http://www.example.com"; Intent i = new Intent(Intent. ACTION_VIEW); i.
Use the Intent.ACTION_VIEW constant as Intent action and the url as data.
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
activity.startActivity(intent);
Note the URL must be a full URL (starting with either http:// or https://) so check in your code that the URL is not a short form such as www.google.com if it is user-defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With