Code example for ConsoleMessage

Methods: lineNumbermessagemessageLevelsourceId

0
	private void setupWebView(WebView webView) {
		webView.getSettings().setJavaScriptEnabled(true);
		 
		webView.setWebChromeClient(new WebChromeClient() {
			public boolean onConsoleMessage(ConsoleMessage cm) {
				if (cm.messageLevel() == ConsoleMessage.MessageLevel.LOG) {
					Log.i("mobile_planner.js", cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
				} 
				if (cm.messageLevel() == ConsoleMessage.MessageLevel.WARNING) {
					Log.w("mobile_planner.js", cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
				} 
				if (cm.messageLevel() == ConsoleMessage.MessageLevel.ERROR) {
					Log.e("mobile_planner.js", cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
				} 
				return true; 
			} 
		}); 
		 
		webView.setWebViewClient(new WebViewClient() {
			@Override 
Experience pair programming with AI  Get Codota for Java