14

How to convert a website into an Android App

Everyone wants to make an Android app of their website So if you also wish to create a responsive app for your website then you are in the right place on How to convert a website into an Android App, You can also check my last post which is about How To Make And Android App For Free!

Hey, guys, it is fascinating to know, If you are running a website and you need to know How to convert a website into an Android App. It is very simple as converting the whole site feeds into an Android app just follow some steps. It may be very useful for you.

To get started with How to convert a website into an Android App, we need to go on Android Studio page, and just click on Android Studio developers link,

  • Download Studio beta version, and install it. It will install in program file in c drive.
  • Go to program file and open Android folder then
  • android folder -> android studio -> SDK -> SDK manager.exe file
  • install .exe file then further install all tools given in the dialog box.
  • Now open Android Studio and click on New Project, Name the new project.

Untitled

 

  • Select min. SDK, in this we will select the version of Android, then click on NEXT and choose the activity. If you are using android studio the first time, then it will take some time to open it.
  • Then a tip box will open close it if you do not need any advice.
  • Now you can see whole files are opening. There are some changes you need to make in this.
  • Change text view into web view change code. No need to worry about it. You can get the code from android studio website in PDF file.
  • Click on my activity java and you can add few lines of code here in between the curly braces “private web view” if it is looking for red color then it is wrong. So by pressing ALT and ENTER, you can remove it.
  • Now add your URL of the website which you want to convert into App.
  • Right now we have to take permission for internet access so click on my .xml file.
  • open Android manifest.XML file .Untitled

 

 

  • Now click on Tools -> Android -> AVD (android virtual device).
  • start -> wipe user data -> launch.
  • open android studio -> run -> run App. here you have to wait for a bit of time.

Here is Code:-

MainActivity.java



package com.ravi.hackersden.logicsarray;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends ActionBarActivity {
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
WebViewClient webViewClient = new WebViewClient();
mWebView.setWebViewClient(webViewClient);

WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("https://hackersdenabi.net/");
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}

Note:- Replace ” https://hackersdenabi.net” with your website url.


Layout file activity_main.xml 

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    tools:ignore="MergeRootFrame">

    <WebView
        android:id="@+id/activity_main_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</FrameLayout>

 


AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ravi.hackersden.logicsarray" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

 

 

Voila And You Website to app conversion is ready 🙂 Cheers You Made Your App. If you have any doubts, then feel free to use our comment section and don’t forget to share this post

The following two tabs change content below.
Abishiekh Jain is a 16-year-old programmer and blogger born and brought up in Chennai. He is the founder of Hackers Den 🙂

Latest posts by Abishiekh Jain (see all)

Click Here to Leave a Comment Below 14 comments