Sending an Intent to browser to open specific URL

poeschlorn picture poeschlorn · Jun 9, 2010 · Viewed 629.9k times · Source

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?

Answer

aioobe picture aioobe · Jun 9, 2010

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