Posts

Showing posts from April, 2013

WebView in Android

WebView displays web pages.

package com.example.webview;

import android.os.Bundle;
import android.app.Activity;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class MainActivity extends Activity {
    private WebView webView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webView1);
     WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
webView.loadUrl("http://www.mobengineers.com");

}

}


activity_main.xml


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <WebView
        android:id="@+id/webView1"
        android:…