set WebView page cache - Android User Interface

Android examples for User Interface:WebView

Description

set WebView page cache

Demo Code


//package com.book2s;
import java.lang.reflect.Method;

import android.webkit.WebSettings;

public class Main {
    /**/*from w  ww .j  a v a2 s  .  co m*/
     * set page cache
     *
     * @param settings
     * @param capacity
     */
    public static void setWebViewPageCache(WebSettings settings,
            int capacity) {
        try {
            Method setPageCache = settings.getClass().getMethod(
                    "setPageCacheCapacity", new Class[] { int.class });
            setPageCache.invoke(settings, new Object[] { capacity });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related Tutorials