android.webkit.WebView - Web Browser Base Class

This section provides a tutorial example on how to create an Android project to build your own Web browser using the android.webkit.WebView class. The first version failed with 'Webpage not available' error.

Android SDK offers a nice view class, android.webkit.WebView, that helps you to build your version of a Web browser. Here is my first version of AndroidWeb application:

Create AndroidWeb project with the "android create project" command:

C:\herong>\local\android-sdk-windows\tools\android create project \
   -k com.herongyang.web -a AndroidWeb -t 2 -p .\AndroidWeb

Edit the activity class Java code stored at \herong\AndroidWeb\src\com\herongyang\web\

 * Version 1.0 - Show Google home page
 * Copyright (c) 2015,, All Rights Reserved.
package com.herongyang.web;

import android.os.Bundle;
import android.webkit.WebView;
public class AndroidWeb extends Activity {
   public void onCreate(Bundle savedInstanceState) {

      WebView view = new WebView(this);

Build the debug package and install it to the emulator using the "ant" command:

C:\herong\AndroidWeb>\local\apache-ant-1.8.3\bin\ant debug

C:\herong\AndroidWeb>\local\apache-ant-1.8.3\bin\ant installd

Run AndroidWeb on the emulator. Too bad. AndroidWeb 1.0 is not working. The following message is showing on the screen:

Webpage not available

The webpage at could not be loaded because:

AndroidWeb Webpage not available Error
AndroidWeb Webpage not available Error

The error is not very helpful. I will try to find the root cause in the next tutorial.

By the way, the same program running in Android SDK R17 gave the following error message:

Webpage not available

The webpage at might be temporarily down or
it may have moved permanently to a new web address.

   Make sure you have a data connection
   Reload this webpage later
   Check the address you entered

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 AboutAndroid - Application to Retrieve System Information Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

Building Your Own Web Browser

android.webkit.WebView - Web Browser Base Class

 AndroidWeb - My Own Web Browser

 WebViewClient Subclass - Content Rendering Callbacks

 saveWebArchive() Method - Saving Web Archive Files

 Web Archive File - XML File of Base64 Encoded Data

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Archived Tutorials


 Full Version in PDF/EPUB