Note that there are some explanatory texts on larger screens.

plurals
  1. POneed help for webview
    primarykey
    data
    text
    <pre> final Context myApp = this; /* An instance of this class will be registered as a JavaScript interface */ class MyJavaScriptInterface { @SuppressWarnings("unused") public void showHTML(String html) { new AlertDialog.Builder(myApp) .setTitle("HTML") .setMessage(html) .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .create() .show(); } } final WebView browser = (WebView)findViewById(R.id.browser); /* JavaScript must be enabled if you want it to work, obviously */ browser.getSettings().setJavaScriptEnabled(true); /* Register a new JavaScript interface called HTMLOUT */ browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT"); /* WebViewClient must be set BEFORE calling loadUrl! */ browser.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { /* This call inject JavaScript into the page which just finished loading. */ browser.loadUrl("javascript:window.HTMLOUT.showHTML(''+document.getElementsByTagName('html')[0].innerHTML+'');"); } }); /* load a web page */ browser.loadUrl("http://lexandera.com/files/jsexamples/gethtml.html"); </pre> <p>In to the above code after </p> <pre> new AlertDialog.Builder(myApp) .setTitle("HTML") .setMessage(html) .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .create() .show(); </pre> <p>I want to set visibility of the button true and false but it gives me error does any one have any idea why its happens and have any solution? Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload