How to Make Simple Browser in Android

In this tutorial I will guide you to make simple web browser in android.

Android provides an awesome UI widget known as WebView. It is used to load web pages and view HTML data. We will use WebView class to make a simple browser with some functionality.

If you don’t know about WebView then I would recommend you to read my previous tutorial on it.

Read: Android WebView Example

 

How to Make Simple Browser in Android

I used some methods of WebView class that perform following functions.

loadUrl(): It loads a web page from url

canGoBack(): It checks if previous page history is available

goBack(): Go to previous page

canGoForward(): It checks if next page history is available

goForward(): Go to next page

reload(): Reload current page

stopLoading(): stop loading of current page

 

This browser will allow you to do following things.

  • Open a web page url.
  • Cancel loading of a web page.
  • Go to previous or next web page.
  • Reload a web page.
  • See the progress of loading of web page in progress bar.

 

Create an android project with package name com.androidbrowser and add following code in respective files.

activity_main.xml

 

MainActivity.java

Note: Make sure you add internet access permission. Just add following line in AndroidManifest.xml file.

 

That’s it, you have done. Just run the project and enjoy browsing internet.

 

Output

How to Make Simple Browser in Android

 

Watch Demo

Comment below if you have any doubts related to above tutorial. If you liked it then take your few seconds to share with others.

Happy Coding!! 🙂 🙂

Leave a Comment

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