views:

97

answers:

2

I want to make somethink like hyperlink. Right now, i created button, which opens new Activity with WebView. But i want to open a "globally" default web browser at specified url. How can i do this ?

+1  A: 

Just make and Intent and set the link as uri to the intent. Then use the intent to start activity. Try this:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://stackoverflow.com")));
Konstantin Burov
+3  A: 

You can fire a global intent that will be picked up by the browser

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

Also make sure to add the web permission to your manifest

<uses-permission android:name="android.permission.INTERNET" />
sadboy
Permission is not needed since its browser accesses the network, not the user app.
Konstantin Burov
Ahh, good catch.
sadboy