Answers for "webview set url"

12

webview in android studio

private WebView webView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        webView = (WebView) findViewById(R.id.webview);
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("https://www.javatpoint.com/java-tutorial");

        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);

    }
    @Override
    public void onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack();
        } else {
            super.onBackPressed();
        }
    }
Posted by: Guest on June-07-2020
0

webview load url

webView.loadUrl("https://google.com");
Posted by: Guest on June-05-2021
0

webview load url

// Private variable
private WebView web;

// Locating the webView ID form (For example activity_main)
myWebView = findViewById(R.id.myWebView);

// Loading the URL (google.com) into the webview
web.loadUrl("https://google.com");
Posted by: Guest on June-05-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language