Answers for "how to add webview in android studio while making tv apps"

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

Code answers related to "how to add webview in android studio while making tv apps"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language