Skip to main content

How To Make Website into Android App?

How To Make Website into Android App?

This is the Solution



1. Open your android studio.

2. Click on create new project.

     

create new project in android studio


3. Click on empty activity option.

    


4. Open your AndroidMainfest.xml file in apps->mainfests folder.

5. Paste the following lines of code there and save it.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mtcst">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/Theme.MTCST">
<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>

6. Now open your MainActivity.java file, paste the following code and save it.

package com.example.mtcst;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {
private WebView mywebview;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mywebview=(WebView) findViewById(R.id.webview);
WebSettings webSettings=mywebview.getSettings();
webSettings.setJavaScriptEnabled(true);
mywebview.loadUrl("https://www.mukkibhatt.com/");
mywebview.setWebViewClient(new WebViewClient());
}
@Override
public void onBackPressed()
{
if(mywebview.canGoBack())
{
mywebview.goBack();
}
else
{
super.onBackPressed();
}
}
}

7. Change the parameter in loadUrl function to your website name. 

8. Now open your activity_main.xml file, paste the following code and save it.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:layout_editor_absoluteY="1dp" />

</androidx.constraintlayout.widget.ConstraintLayout>

9. Navigate to build option and build your project.

    


10. You can also run your project with the run option so you can view your apk in your pc.

11. Navigate to your project file 

        C:\Users->(user_name)->AndroidStudioProjects->(project_name)->app->build->outputs->apk->debug->app-debug.apk

The above location is the default location of your project and app-debug.apk is the apk that you  created.

Comments

Popular posts from this blog

How to Setup Reddit avatar? Username Profile?

Setup easily you account in reddit  One simple step is to Randomize it. And other one is to select each from  FACIAL HAIR,  BOTTOMS,  TOPS,  HAIR and  BODY COLOR. Today i first time created an account in Reddit.com You can visit my profile by this link  https://www.reddit.com/user/Mukkibhatt/ My  Reddit Profile IT is very important to set a good Username in the starting, otherwise you wont get the name you want and was available earlier  OR you can chose by uplaoding images from your computer. like i did.

Cybersecurity: Protect Your Privacy From Hackers

     Call it anti-hacker software or go a bit further, but it will not stop a determined hacker from using such software to make it more difficult for hackers to get into your computer and access your data. For example, browser plugins can be used to prevent websites from tracking you. While Facebook can still track you when it's open, you don't have to be there all the time to track your browsing history, which can then be used to deliver targeted ads.       You can protect your computer by using a firewall and antivirus software and adhering to best practices for computer use. You can also protect your mobile devices by turning off Bluetooth when it is not in use, paying attention to the Wi-Fi network you are connected to, and using security applications to improve monitoring and protection.       As already mentioned, Internet-connected televisions and devices are widely available on the market. It is important to protect these devices, just like computers and smartphones. T