Open Web Browser in Android with Specific URL

Posted By on March 23, 2016

Download PDF
Android Intent
Android Service

Here we will learn the simple way to open web browser in android with a webpage or link (specific URL) from your Android application. It is very simple to launch a web page programmatically from your android application. We will use android intent to open web browser here.

open web browser in android  open web browser in android

Code Snippet for Open a Web page in Android Application

The below code snippet is for Open a web page from Android application, which will open the web page with the default web browser in Android.

 Note: Just import below packages if it gives error while running the above code snippet in your program.

 Complete Example Code for Open Web Page in Android

In the attached code, we have used an button called ‘Open Web Browser’ and we will open a specific URL while click on that button.

  • Android Layout File

This is the default android layout file which just contains a button, from that button click we will open the web browser.

  •  MainActivity.Java File

In this file we have code for onOpenWebBrowser() function, from that we have written code for open web browser in android.

Android Intent
Android Service

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby