Android WebChromeClient - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android WebChromeClient class.

This code example shows how to use the following methods:
    initWebView(); 
  } 
 
  private void initWebView() { 
    mWebView.setWebViewClient(new WebViewClient());
    mWebView.setWebChromeClient(new WebChromeClient());
    WebSettings settings = mWebView.getSettings();
    settings.setSavePassword(true);
    settings.setSaveFormData(true);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(false);
    settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    settings.setDomStorageEnabled(true);
    settings.setSupportMultipleWindows(false);
 
 
    mWebView.loadUrl("http://developer.android.com");
  } 
 
  @Override 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:onConsoleMessage
 
    /** {@inheritDoc} */ 
    @Override 
    @Deprecated 
    public void onConsoleMessage(String message, int lineNumber, String sourceID) {
        mWrappedClient.onConsoleMessage(message, lineNumber, sourceID);
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
        return mWrappedClient.onConsoleMessage(consoleMessage);
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public Bitmap getDefaultVideoPoster() {
        return mWrappedClient.getDefaultVideoPoster();
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:onCreateWindow
    WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
    transport.setWebView((WebView) newView.getUnderlyingView());
    resultMsg.sendToTarget();
 
    wdChromeClient.onCreateWindow(newView);
    return delegate.onCreateWindow(view, dialog, userGesture, resultMsg);
  } 
 
  @Override 
  public void onRequestFocus(WebView view) {
    delegate.onRequestFocus(view);
  } 
 
  @Override 
  public void onProgressChanged(WebView view, int newProgress) {
    wdChromeClient.onProgressChanged(view, newProgress);
    delegate.onProgressChanged(view, newProgress);
  } 
 
  @Override 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		if (isDarkTheme(context)) {
			webView.setBackgroundColor(Color.BLACK);
			styles += "body { background-color: #000000; color: #F6F6F6; } a { color: #0099FF; }";
		} 
		String html = String.format("<html><head><meta charset=\"utf-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://cdn.uservoice.com/stylesheets/vendor/typeset.css\"/><style>%s</style></head><body class=\"typeset\" style=\"font-family: sans-serif; margin: 1em\"><h3>%s</h3>%s</body></html>", styles, article.getTitle(), article.getHtml());
		webView.setWebChromeClient(new WebChromeClient());
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setPluginState(PluginState.ON);
		webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
	} 
 
    public static boolean isDarkTheme(Context context) {
        TypedValue tv = new TypedValue();
        float [] hsv =  new float[3];
        context.getTheme().resolveAttribute(android.R.attr.textColorPrimary, tv, true);
        Color.colorToHSV(context.getResources().getColor(tv.resourceId), hsv);
        return hsv[2] > 0.5f;
    } 
 
	@SuppressLint("DefaultLocale") 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:onConsoleMessage
 
    /** {@inheritDoc} */ 
    @Override 
    @Deprecated 
    public void onConsoleMessage(String message, int lineNumber, String sourceID) {
        mWrappedClient.onConsoleMessage(message, lineNumber, sourceID);
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
        return mWrappedClient.onConsoleMessage(consoleMessage);
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public Bitmap getDefaultVideoPoster() {
        return mWrappedClient.getDefaultVideoPoster();
    } 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android WebChromeClient Questions & Answers:

See Code Examples for Android WebChromeClient Methods: