Tech

How To Convert Website Into Android Application

Follow these simple steps:

Step 1:

<uses-permission  android:name="android.permission.INTERNET"></uses-permission>

Step 2:

android:id="@+id/webview"

step 3:

import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

step 4:

private WebView mywebView;

step 5:

 mywebView=(WebView) findViewById(R.id.webview);
 mywebView.setWebViewClient(new WebViewClient());
 mywebView.loadUrl("https://saqibjassar.com/");
 WebSettings webSettings=mywebView.getSettings();
 webSettings.setJavaScriptEnabled(true);

step 6:

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();
            }
}

Leave a comment

Your email address will not be published. Required fields are marked *

Scan the code