ConsoleMessage message - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ConsoleMessage message method.

This code example shows how to use the following methods:lineNumber, message, messageLevel, sourceId
	} 
 
	@Override 
	public boolean onConsoleMessage(ConsoleMessage message)
	{ 
		switch (message.messageLevel()) {
			case DEBUG:
				Log.d(CONSOLE_TAG, message.message() + " (" + message.lineNumber() + ":" + message.sourceId() + ")");
				break; 
			default: 
				Log.i(CONSOLE_TAG, message.message() + " (" + message.lineNumber() + ":"+ message.sourceId() + ")");
				break; 
		} 
		return true; 
	} 
 
	public boolean onJsAlert(WebView view, String url, String message, final android.webkit.JsResult result)
	{ 
		TiUIHelper.doOkDialog("Alert", message, new OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
9
CodeRank
This code example shows how to use the following methods:lineNumber, message, messageLevel, sourceId
                    view = convertView;
                } 
 
                TextView headline = (TextView) view.findViewById(android.R.id.text1);
                TextView subText = (TextView) view.findViewById(android.R.id.text2);
                headline.setText(error.sourceId() + ":" + error.lineNumber());
                subText.setText(error.message());
                switch (error.messageLevel()) {
                    case ERROR:
                        subText.setTextColor(Color.RED);
                        break; 
                    case WARNING:
                        // Orange 
                        subText.setTextColor(Color.rgb(255,192,0));
                        break; 
                    case TIP:
                        subText.setTextColor(Color.BLUE);
                        break; 
                    default: 
                        subText.setTextColor(Color.LTGRAY);
7
CodeRank
This code example shows how to use the following methods:lineNumber, message, sourceId
			activity.setTitle(title);
	} 
 
	@Override 
	public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
		Log.v(TAG, consoleMessage.sourceId() + ':' + consoleMessage.lineNumber() + " " + consoleMessage.message());
		return true; 
	} 
} 
7
CodeRank
This code example shows how to use the following methods:lineNumber, message, sourceId
 
    private final static String TAG = TomahawkWebChromeClient.class.getName();
 
    @Override 
    public boolean onConsoleMessage(ConsoleMessage cm) {
        Log.d(TAG, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
        return true; 
    } 
 
    @Override 
    public void onConsoleMessage(String message, int lineNumber, String sourceID) {
        Log.d(TAG,
                "invoked: onConsoleMessage() - " + sourceID + ":" + lineNumber + " - " + message);
        super.onConsoleMessage(message, lineNumber, sourceID);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:lineNumber, message, sourceId
      viewClient_.onReceivedLoginRequest(view_, realm, account,
          args);
    } 
  } 
   
  // DownloadListener proxy methods. 
  @Override 
  public void onDownloadStart(String url, String userAgent,
      String contentDisposition, String mimeType, long contentLength) {
    if (downloadListener_ != null) {
      downloadListener_.onDownloadStart(url, userAgent, contentDisposition,
          mimeType, contentLength);
    } 
  } 
   
  // FindListener proxy methods. 
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override 
  public void onFindResultReceived(int activeMatchOrdinal,
      int numberOfMatches, boolean isDoneCounting) {
7
CodeRank
This code example shows how to use the following methods:lineNumber, message, sourceId
   * @param consoleMessage Object containing details of the console message. 
   * @return true if the message is handled by the client. 
   */ 
  public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
      // Call the old version of this function for backwards compatability. 
      onConsoleMessage(consoleMessage.message(), consoleMessage.lineNumber(),
              consoleMessage.sourceId());
      return false; 
  } 
 
  /** 
   * When not playing, video elements are represented by a 'poster' image. The 
   * image to use can be specified by the poster attribute of the video tag in 
   * HTML. If the attribute is absent, then a default poster will be used. This 
   * method allows the ChromeClient to provide that default image. 
   * 
   * @return Bitmap The image to use as a default poster, or null if no such image is 
   * available. 
   */ 
  public Bitmap getDefaultVideoPoster() {
7
CodeRank
This code example shows how to use the following methods:lineNumber, message, messageLevel, sourceId
    } 
 
    private class HelloWebChromeClient extends WebChromeClient {
        @Override 
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.d(TAG, cm.message()
                    + " -- " + cm.messageLevel()
                    + " From line " + cm.lineNumber()
                    + " of " + cm.sourceId() );
            return true; 
        } 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState)
    { 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        mWebView = (WebView) findViewById(R.id.webview);
6
CodeRank
This code example shows how to use the following methods:lineNumber, message, sourceId
		webView.getSettings().setJavaScriptEnabled(true);
		webView.setWebChromeClient(new WebChromeClient() { // Purely for
															// debugging. 
			public boolean onConsoleMessage(ConsoleMessage msg) {
				Log.d(TAG,
						"console: " + msg.message() + " at " + msg.sourceId()
								+ ":" + msg.lineNumber());
				return false; 
			} 
		}); 
		webView.setWebViewClient(new WebViewClient() { // Purely for debugging.
			public void onReceivedError(WebView view, int errorCode,
					String description, String failingUrl) {
				Log.e(TAG, "JS error: " + errorCode + " in " + failingUrl
						+ ", desc: " + description);
			} 
		}); 
		proxyingMessageHandler = new ProxyingMessageHandler(activity, handler);
		webView.addJavascriptInterface(proxyingMessageHandler,
				"androidMessageHandler"); 
5
CodeRank
This code example shows how to use the following methods:lineNumber, message
    } 
 
    public void appendConsoleMessage(ConsoleMessage consoleMessage) {
        StringBuilder output = getStringBuilderForType(OutputType.CONSOLE_MESSAGE);
 
        output.append("CONSOLE MESSAGE: line " + consoleMessage.lineNumber());
        output.append(": " + consoleMessage.message() + "\n");
    } 
 
    public void appendJsAlert(String message) {
        StringBuilder output = getStringBuilderForType(OutputType.JS_DIALOG);
 
        output.append("ALERT: ");
        output.append(message);
        output.append('\n');
    } 
 
    public void appendJsConfirm(String message) {
        StringBuilder output = getStringBuilderForType(OutputType.JS_DIALOG);
 
5
CodeRank
This code example shows how to use the following methods:lineNumber, message, sourceId
	private void createEditor()  { 
		webView = new WebView(this);
		webView.setWebViewClient(new HappyGUIWebViewClient());
		webView.setWebChromeClient(new WebChromeClient() {
			public boolean onConsoleMessage(ConsoleMessage cm) {
				Log.d("Error in WebView!", cm.message() + " -- From line "
						+ cm.lineNumber() + " of "
						+ cm.sourceId() );
				return true; 
			} 
		}); 
		webView.getSettings().setJavaScriptEnabled(true);
		webView.loadUrl("file:///android_asset/html5/editor.html");
		androidJS = new JSObject(webView);
		webView.addJavascriptInterface(androidJS, "jsObject"); // Facilitates communication between Javascript and Java 
	} 
 
	protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
		super.onActivityResult(requestCode, resultCode, intent);
 
6
CodeRank

Related ConsoleMessage message Questions & Answers:

message Method Overview
See Code Examples for other Android ConsoleMessage Methods: