open a url on click of ok button in android

User picture User · Feb 8, 2011 · Viewed 132.8k times · Source

I have to open a URL on Click of OK Button in a view. Can someone tell how to do this?

Answer

Parag Chauhan picture Parag Chauhan · Feb 8, 2011

On Button click event write this:

Uri uri = Uri.parse("http://www.google.com"); // missing 'http://' will cause crashed
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

that open the your URL.