WebSettings setAppCachePath - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:setAllowFileAccess, setAppCacheEnabled, setAppCacheMaxSize, setAppCachePath, setCacheMode
7
CodeRank
This code example shows how to use the following methods:setAllowFileAccess, setAppCacheEnabled, setAppCacheMaxSize, setAppCachePath, setCacheMode
    public void setAppCachedPolicy(WebSettings settings) {
        File file = new File(mCachePath);
        if( !file.exists() ) {
            file.mkdirs();
        } 
        settings.setAppCachePath(mCachePath);
        settings.setAppCacheMaxSize(BUFFER_SIZE);
        settings.setAppCacheEnabled(true);
        settings.setAllowFileAccess(true);
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    } 
 
    /** 
     * 清除app的缓存数据,例如online模式清除离线缓存数据及localStorage信息 
     * @param app[in] 
     * @param context[in] 
     */ 
    public void clearAppData(XApplication app, Context context) {
    } 
 
6
CodeRank
This code example shows how to use the following methods:setAppCacheEnabled, setAppCacheMaxSize, setAppCachePath, setDatabaseEnabled, setDatabasePath
		wb.loadUrl(HTML_TESTS_URL);
		 
		WebSettings webSettings = wb.getSettings();
		 
		//page needs javascript enabled to run 
		webSettings.setJavaScriptEnabled(true);
		 
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR_MR1) {
			webSettings.setDomStorageEnabled(true);
			webSettings.setAppCacheEnabled(true);
			webSettings.setAppCachePath(getCacheDir().getAbsolutePath());
	        webSettings.setAppCacheMaxSize(1 * 1024 * 1024);
		} 
		 
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
	        webSettings.setDatabaseEnabled(true);
	        webSettings.setDatabasePath("/data/data/" + getPackageName() + "/databases");
		} 
		 
		//show content 

6
CodeRank
This code example shows how to use the following methods:setAppCacheEnabled, setAppCacheMaxSize, setAppCachePath
    } 
 
    private static class HelperInternal { 
 
        private static void setCacheSettings(Context context, WebSettings settings) {
            settings.setAppCacheMaxSize(1024 * 1024); // 1MB
            settings.setAppCachePath(context.getCacheDir().getAbsolutePath());
            settings.setAppCacheEnabled(true);
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:setAppCacheEnabled, setAppCacheMaxSize, setAppCachePath, setCacheMode, setDatabaseEnabled
 
    WebSettings settings = webView.getSettings();
 
    // Enabling the app cache without setting a path crashes webcore on 
    // gingerbread.  Explicitly setting the path seems to work. 
    settings.setAppCacheEnabled(true);
    settings.setAppCachePath(appCacheRoot.getAbsolutePath());
    settings.setAppCacheMaxSize(BROWSER_SETTINGS_APP_CACHE_SIZE);
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);
    settings.setDatabaseEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setJavaScriptEnabled(true);
    settings.setPluginsEnabled(true);
    settings.setSupportMultipleWindows(true);
 
    CookieManager.getInstance().setAcceptCookie(true);
  } 
 
  public void setCondition(ConditionVariable cv) {
4
CodeRank
This code example shows how to use the following methods:setAppCacheEnabled, setAppCachePath, setDatabaseEnabled, setDatabasePath, setDomStorageEnabled
4
CodeRank
This code example shows how to use the following methods:setAppCacheEnabled, setAppCachePath, setBuiltInZoomControls, setCacheMode, setDatabaseEnabled
        final String internalFilePath = activtiy.getFilesDir().getPath();
        // http://stackoverflow.com/questions/10097233/optimal-webview-settings-for-html5-support 
        final WebSettings s = webView.getSettings();
        webView.setFocusable(true);
        webView.setFocusableInTouchMode(true);
        s.setJavaScriptEnabled(true);
        s.setJavaScriptCanOpenWindowsAutomatically(true);
        s.setPluginState(WebSettings.PluginState.ON_DEMAND);
        s.setRenderPriority(WebSettings.RenderPriority.HIGH);
        s.setCacheMode(WebSettings.LOAD_NO_CACHE); // WebSettings.LOAD_DEFAULT
        s.setDomStorageEnabled(true);
        s.setDatabaseEnabled(true);
        s.setDatabasePath(internalFilePath + "databases/");
        s.setAppCacheEnabled(true);
        s.setAppCachePath(internalFilePath + "cache/");
        webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        // Configure the webview https://code.google.com/p/html5webview/source/browse/trunk/HTML5WebView/src/org/itri/html5webview/HTML5WebView.java 
        s.setBuiltInZoomControls(true);
        s.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        s.setUseWideViewPort(true);

-3
CodeRank

Related WebSettings setAppCachePath Questions & Answers:

setAppCachePath Method Overview
Sets the path to the Application Caches files.
See Code Examples for other Android WebSettings Methods: