Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending an Intent to browser to open specific URL [duplicate]

I'm just wondering how to fire up an Intent to the phone's browser to open an specific URL and display it.

Can someone please give me a hint?

like image 857
poeschlorn Avatar asked Jun 09 '10 09:06

poeschlorn


People also ask

How do I open a URL from an intent?

To open a URL/website you do the following: String url = "http://www.example.com"; Intent i = new Intent(Intent. ACTION_VIEW); i.

What is intent URL?

In this way, an Intent is like the dual of a hyperlink. With a hyperlink, the source page specifies the exact URL to be navigated to. With an Intent, the source page specifies the nature of the task to be done, and the user can select any of a number of applications to be used to complete the task.


2 Answers

To open a URL/website you do the following:

String url = "http://www.example.com"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); 

Here's the documentation of Intent.ACTION_VIEW.


Source: Opening a URL in Android's web browser from within application

like image 179
aioobe Avatar answered Sep 21 '22 22:09

aioobe


The short version

startActivity(new Intent(Intent.ACTION_VIEW,      Uri.parse("http://almondmendoza.com/android-applications/"))); 

should work as well...

like image 27
Juri Avatar answered Sep 21 '22 22:09

Juri