RunCodes
Programming & Tech

How to Convert a Website into Android Application using Android Studio?

3 723

As you all know guyz, This is an era of smart phone and everybody own smart phone. So, everything is converting into mobile apps especially into android apps. So, in this tutorial we are gonna learn about how you can convert your website into and android apps. This is very simple and easy so follow the following steps.

Thing you should know before doing the steps:

1. You must have your own website which should be responsive. You may not know what is responsive website, a responsive website means no matter which devices you used to open your website it renders all your website compatible to that device perfectly.

2. Having Android Studio installed in your system and any AVD (Android virtual device like, android studio built-in or any third party AVD, or any android phone).

Steps:

[sociallocker]

1. Open android studio and create the new project and Design the user interface from activity_main.xml file. You can see all the procedure at the end of this web page from video or you can copy the xml file from below.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ran.com.websiteapps.MainActivity">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/wbview" />
</RelativeLayout>

Note: Change the package name i.e ran.com.websiteapps to yours own package name. You can find this package name at the top of MainActivity.java file.

2. Write the java like code in MainActivity.java file.


package ran.com.websiteapps;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {
WebView webView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView=(WebView)findViewById(R.id.wbview);
WebSettings webSettings=webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("https://techsupportnep.com");
webView.setWebViewClient(new WebViewClient());

}

@Override
public void onBackPressed() {
if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
}

That’s is. if you like this article don’t forget to share this with your friends.

[/sociallocker]

 

For more watch the following video.

 

 

Show Comments (3)