Open Web Browser in Android with Specific URL Example Code

android-logoHow to Open Web Browser in Android Programmatically

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.

 downloadDownload Complete code for “How to Open a Web Page in Android Programmaticallyfrom here.

I hope this small tutorial on open a web page in android will help you at it’s best.

 

Post By SmrutiRanjan (54 Posts)

Working @ Samsung as a Project Lead for Android Smartphones. I have been blogging since 2008. Previously I was writing articles for other bloggers, but finally I have started my own blog-"Techblogon".I am also an active contributor for the blog-"Gadgets n Gizmos World". Job is my necessity, but blogging is my passion.

Website: → Techblogon

Connect

5 Responses to Open Web Browser in Android with Specific URL Example Code

  1. Er.Surya Prakash Chamoli says:

    internet permission give in androidmainfest.xm
    android:name=”android.permission.internet”

  2. jigar says:

    brother..u have made awsm and useful site…but the only -ve point of your site is…that “sparrow” sat flies every where..in whole screen.it breaks concentration..so please make it stable…thank you…! lip it up bro….:)

  3. jeetu says:

    h i have read yours blog these are very good you are the best blog writer on android compare to other in case of simplecity of code can you help me that how to run google map application in emulator i have try on internet but not get any solution if you have any idea or any web link which can solve my problem so please tell me

    thank you

  4. e3r8ick says:

    Thanks exactly what I needed!!!

  5. www.celling.com.ua says:

    Hi there, I wish for to subscribe for this web site to get hottest updates,
    therefore where can i do it please help.

Leave a Reply

Your email address will not be published. Required fields are marked *


+ six = 9

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">