How to Technology

How to Convert website to Android App

Android Manifest

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

Activity Main

android:id="@+id/webview"
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
private WebView mywebView;
 mywebView=(WebView) findViewById(R.id.webview);
 mywebView.setWebViewClient(new WebViewClient());
 mywebView.loadUrl("https://speora.org/");
 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();
            }
}

About the author

admin

Add Comment

Click here to post a comment

Topics