Build a simple Android web browser in Eclipse

In this post you will learn to make a simple android web browser using java. You also get to know more about webview, WebViewClient etc.

Its normally impossible for a person to remember the entire functions/code in android java. Remembering a nutshell is always a good solution.

So here is a nutshell of what we are going to do here.

NUTSHELL

  • Android uses Webview container to load the web URL in the application intend.
  • loadUrl(“http://www.google.com”) is the function for loading the url.
  • Webview container should be configured with a WebViewClient , so that the sites opens up in our application rather than launching other browsers.

  •  
  • use WebChromeClient  to use the progress bar functionalities.
  • URL passed to the webview should be validated, ie it should be having http:// or https:// . We have used

Download

So let us see how it is implemented in here:

LEVEL 1 : [Basic Level ]

  1. Create a project with blank activity ( MySimpleBrowserActivity ).
  2. We need to add webveiw to XML file.

 

3. In the MainActivity ie here MySimpleBrowserActivity

 

4. Add the Internet Access permission the Android Manifest File.

 

5. Is this complete yet. No!

LEVEL 2: [ Intermediate level ]

  1. MySimpleBrowserActivity.java

 

2. Layout — > main.xml

 

 

3. The AndroidManifest.xml