Convert Website to Android Application

In this Android Studio article i want to show you how to Convert Website to Android Application, so for this purpose we are going to use android WebView, the WebView class is an extension of Android’s View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page. also you can check my more android development articles in the below line.

 

 

 

Also you can read more android development articles

1: Android Development Articles

 

 

 

 

 

First of all create a new project in your Android Studio, and choose Empty Activity

also iam using API 22 for this project.

 

 

 

 

After creation of the project, we are going to create a new empty activity at name of

SplashActivity, because before loading of the website i want to have a splash screen.

now you need to open activity_splash.xml , and you need to add this code in that file,

basically iam going to add an ImageView with TextView and the layout is ContraintLayout.

make sure that you have copied an image in your drawable folder.

 

 

 

 

 

After that we are going to open SplashActivity.java , and we are going to add

our splash screen code in their.  so this will be the complete code for my SplashActivity.java.

 

 

 

 

Now we need to bring changes to our manifest file, because by default the launcher

activity is our MainActivity, but we need to change that to SplashActivity.

 

 

 

 

Because iam using internet in this application, i need to add internet permission in my

manifest file.

 

 

 

 

So now the SplashActivity has been completed, now we are going to open our

activity_main.xml , and we need to add a WebView.

 

 

 

 

After that you need to open your MainActivity.java and add the webview code.

 

 

 

 

 

Also we need to override the onBackPressed method.

 

 

 

 

 

Now this is the complete code for MainActivity.java.

 

 

 

 

 

If you run the code this will be the result

Convert Website to Android Application
Convert Website to Android Application

 

 

 

 

Also you can watch the complete video for this article

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Share via
Copy link
Powered by Social Snap
×