0% found this document useful (0 votes)
2 views2 pages

Web View

The document outlines an Android application that uses a WebView to display web content. It includes a layout XML file defining a LinearLayout with a WebView and a manifest file that requests internet permissions. The Java code initializes the WebView, enables JavaScript and DOM storage, and loads the Wikipedia homepage.

Uploaded by

Shivam kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Web View

The document outlines an Android application that uses a WebView to display web content. It includes a layout XML file defining a LinearLayout with a WebView and a manifest file that requests internet permissions. The Java code initializes the WebView, enables JavaScript and DOM storage, and loads the Wikipedia homepage.

Uploaded by

Shivam kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

<?xml version="1.0" encoding="u -8"?

>

<LinearLayout

xmlns:android="h p://schemas.android.com/apk/res/android"

android:orienta on="ver cal"

android:layout_width="match_parent"

android:layout_height="match_parent">

<WebView

android:id="@+id/webview"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

</LinearLayout>

Manifest xml

<manifest xmlns:android="h p://schemas.android.com/apk/res/android"

package="com.example.webview1">

<uses-permission android:name="android.permission.INTERNET" />

<applica on

...>

...

</applica on>

</manifest>
package com.example.webview1;

import android.os.Bundle;

import android.webkit.WebView;

import android.webkit.WebViewClient;

import androidx.appcompat.app.AppCompatAc vity;

public class MainAc vity extends AppCompatAc vity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.ac vity_main);

WebView webView = findViewById(R.id.webview);

webView.setWebViewClient(new WebViewClient()); // Handles naviga on within the WebView

webView.getSe ngs().setJavaScriptEnabled(true);

webView.getSe ngs().setDomStorageEnabled(true);

webView.loadUrl("h ps://wikipedia.org");

You might also like