how to Convert a website application to an android app using web view, webview, android webview, website into an app, android webview

Convert a website application to an android app using web view

In our previous articles in the android development section, we have covered how to download and install android studio in windows and also discussed how to create and install your first android application on a real device. Having known that, we shall highlight on your to convert a website application to an android app that you can install on your phone, share with other people and even host in google play store.

You may have noticed android apps that are exactly similar to their corresponding websites, the concept used here is that you may not have an intention of redoing the whole website by developing an app for it due to time factor and budget costs and this may trigger you to just come up with a simple application that can act as a prototype before the main app is developed.

A web view is a component in the android system that allows android apps to display webpage contents inside an application. With the use of internet permissions, the content of the webpage is viewed without displaying the URL as it fetches and displays without typing it.

To begin with,

Ensure you have a working website link, in this case, we shall use,

Open android studio and create a new project (refer to on how to create and set up your environment for your first app), in my case I will name it as SolutionSpaceApp

After setting up the environment,

Select the activity_main.xml tab and add the following inside the layout tags

tools:ignore="MissingConstraints" />

So the full activity_main.xml code will be as below

<?xml version="1.0" encoding="utf-8"?>
tools:ignore="MissingConstraints" />
Convert a website application to an android app using web view

Switch to tab and add the following

  • Import these features
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

They allow your app to consume resources from those libraries without adding the content of the libraries in your app.

  • Next, initialize WebView inside the public class
WebView webView;
  • Also add the code below in the OnCreate method

In the loadUrl method, add your website link

boolean connected = false;
ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
//we are connected to a network
connected = true;
connected = false;
webView.setWebViewClient(new WebViewClient());
WebSettings webSettings=webView.getSettings();
  • The full code for will be as follows

You will not that this file will contain errors but they will be fixed in our next step

Convert a website application to an android app using web viewConvert a website application to an android app using web view
  • Next, open the AndroidManifest.xml file in the manifests folder

This is where we will add permissions for accessing the internet as below

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

You will notice when you add the two lines of code in the manifest file, the errors in will disappear, if they do not, click the Make project icon represented by a hammer to fix the project.

The full AndroidManifest code will be


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" package="com.example.solutionspaceapp">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<activity android:name=".MainActivity">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

Having done that, the next step will be running your project having connected your phone through USB and your app will be installed on your phone