Code example for ConsoleMessage

Methods: lineNumbermessagesourceId

0
		 
        WebView webView = (WebView) findViewById(R.id.webView);
        // enable logging 
        webView.setWebChromeClient(new WebChromeClient() {
        	  public boolean onConsoleMessage(ConsoleMessage cm) {
        	    Log.d("Vintages", cm.message() + "\n line " + cm.lineNumber() + " of " + cm.sourceId());
        	    return true; 
        	  } 
        	}); 
         
        // webview settings 
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) 
        	webSettings.setAllowUniversalAccessFromFileURLs(true);
 
        // add webapp interface 
        webView.addJavascriptInterface(new WebAppInterface(this), "Android");
         
        // load index