How To Embed Android WebView to Load URLs Inside Android Apps

You’ve used Facebook, right?

Almost everybody has.

But the question is: have you ever clicked on any link shared by someone?

What happens when you click it?

The URL gets loaded within the Android app.

But why developers at Facebook implemented this feature?

There must be a reason, right?

Of course, there is. And the primary goal of Android Webview is to keep the users within the app.

And in today’s Android webview tutorial, we’ll be understanding how to embed Android webview in your native Android App.

Let’s Get Started

👉 Create a new project under file menu, modify the project details, and choose location for the demo project.

Create a new project

👉 In the next tab, choose Mini Support SDK for your project.

choose Mini Support SDK

👉 Lastly, select Add No Activity and click on finish button.

select Add No Activity

Start Code Integration

👉 activity_main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=""



android:orientation="vertical" >






android:text="" />


👉 Web_view.xml

<?xml version="1.0" encoding="utf-8"?>

<WebView  xmlns:android=""





Want To Create An Android Application?

Validate your app idea and get a free quote.


package com.webviewdemo;


import android.content.Context;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

public class MainActivity extends Activity {

private Button button;

public void onCreate(Bundle savedInstanceState) {

final Context context = this;



button = (Button) findViewById(;

button.setOnClickListener(new OnClickListener() {


public void onClick(View arg0) {

Intent intent = new Intent(context, WebViewActivity.class);







package com.webviewdemo;


import android.os.Bundle;

import android.webkit.WebView;

public class WebViewActivity extends Activity {

private WebView webView;

public void onCreate(Bundle savedInstanceState) {



webView = (WebView) findViewById(;





👉 AndroidManifest.xml

//Android Webview requires INTERNET permission.

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

Now once the user has given Internet permission, run the demo.

 Internet permission

Embed WebView in Android

And Done!

As simple as that!

However, if you’re building an Android app from scratch, and need technical help, talk with experts or hire android app developers to proceed with a professional approach under the right hands of experts.

Grab a free copy of Android webview example from Github.

Author Bio
Amit Patolia
Amit Patolia
Designation: Android Team Lead

Amit Patolia is an Android Team Lead at Space-O Technologies. He has over 9+ years of experience in Android app development. He has guided to develop over 100 Android apps with unique features and functionalities. He also has expertise in Kotlin-based apps.