android app from website, how to make android app free
It is very easy to convert your website into the android app using android studio.
Android studio is a open source app development plateform
download it from below link
https://developer.android.com/studio
Step1: Create a new project
Click on create new project
Step2: Select a Project Template
Choose Empty activity and click on that
Step3: Enter the app name that you want in you mobile screen
and give the package name suppose website is happylife.guru
so we can choose package name guru.happylife.appname
and browse the path for project where you want to save.
and click on finish button
Step 4: Main activity.xml
res> layout> activity_main.xml
Paste below code in to activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
Step 5: MainActivity.java
Change the weburl
if your website url is https://happylife.guru/ paste it in mywebView.loadUrl(“https://happylife.guru/”);
Paste below code in to MainActivity.java file
package com.example.happy_life;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView mywebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mywebView=(WebView) findViewById(R.id.webview);
mywebView.setWebViewClient(new WebViewClient());
mywebView.loadUrl("https://happylife.guru/");
WebSettings webSettings=mywebView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
public class mywebClient extends WebViewClient{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon){
super.onPageStarted(view,url,favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view,String url){
view.loadUrl(url);
return true;
}
}
@Override
public void onBackPressed(){
if(mywebView.canGoBack()) {
mywebView.goBack();
}
else{
super.onBackPressed();
}
}
}
Step 5: Manifest file
Give internet permission to access internet using manifest file
Paste the below code in Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.happy_life">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_happy"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Step 6: Your app is ready to use
D:\Happy_Life\app\build\outputs\apk\debug
here you can find your apk app-debug.apk
now you can install it
Android Development | Tags: how to convert website in to android app, how to make android app, How to make android app from website