Example usage for android.webkit WebView getLayerType

List of usage examples for android.webkit WebView getLayerType

Introduction

In this page you can find the example usage for android.webkit WebView getLayerType.

Prototype

public int getLayerType() 

Source Link

Document

Indicates what type of layer is currently associated with this view.

Usage

From source file:com.quarterfull.newsAndroid.NewsDetailFragment.java

/**
 * This function has no effect on devices with api level < HONEYCOMB
 * @param htmlPage/* w w w.ja  v a  2s  .  c  o  m*/
 * @param webView
 */
public static void SetSoftwareRenderModeForWebView(String htmlPage, WebView webView) {
    if (htmlPage.contains(".gif")) {
        webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
        Log.v("NewsDetailFragment", "Using LAYER_TYPE_SOFTWARE");
    } else {
        //webView.setLayerType(WebView.LAYER_TYPE_HARDWARE, null);
        //Log.v("NewsDetailFragment", "Using LAYER_TYPE_HARDWARE");

        if (webView.getLayerType() == WebView.LAYER_TYPE_HARDWARE) {
            Log.v("NewsDetailFragment", "Using LAYER_TYPE_HARDWARE");
        } else if (webView.getLayerType() == WebView.LAYER_TYPE_SOFTWARE) {
            Log.v("NewsDetailFragment", "Using LAYER_TYPE_SOFTWARE");
        } else {
            Log.v("NewsDetailFragment", "Using LAYER_TYPE_DEFAULT");
        }
    }
}