亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

android webview 中l(wèi)ocalStorage無效的解決方法

 更新時間:2015年06月01日 11:04:41   投稿:junjie  
這篇文章主要介紹了android webview 中l(wèi)ocalStorage無效的解決方法,本文直接給出解決方法實現(xiàn)代碼,需要的朋友可以參考下

我在 android里面 使用html5的 localStorage
為什么存不進去也讀不出來呀?
網(wǎng)上搜了好多都沒效果

復(fù)制代碼 代碼如下:

mainWebView = (WebView)this.findViewById(R.id.mainWebView);
        WebSettings settings = mainWebView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setAllowFileAccess(true);
        settings.setDatabaseEnabled(true);
         String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();  
        settings.setDatabasePath(dir);  
        settings.setDomStorageEnabled(true);
        settings.setGeolocationEnabled(true);

解決方案:

復(fù)制代碼 代碼如下:

mWebView.getSettings().setDomStorageEnabled(true);  
mWebView.getSettings().setAppCacheMaxSize(1024*1024*8); 
String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); 
mWebView.getSettings().setAppCachePath(appCachePath); 
mWebView.getSettings().setAllowFileAccess(true); 

mWebView.getSettings().setAppCacheEnabled(true);


這個測試了是可以的

相關(guān)文章

最新評論