android 中 webview 怎么用 localStorage
更新時間:2015年07月05日 10:55:50 投稿:hebedich
這篇文章主要介紹了android 中 webview 怎么用 localStorage方法的相關(guān)資料,需要的朋友可以參考下
我在 android里面 使用html5的 localStorage
為什么存不進(jìn)去也讀不出來呀?
網(wǎng)上搜了好多都沒效果
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);
解決方案:
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)文章
Android獲取網(wǎng)絡(luò)連接狀態(tài)新方法整理
這篇文章主要給大家介紹了關(guān)于Android獲取網(wǎng)絡(luò)連接狀態(tài)新方法的相關(guān)資料,在開發(fā)安卓移動端時幾乎每一個app都需要連接網(wǎng)絡(luò),因此對設(shè)備的網(wǎng)絡(luò)狀態(tài)檢測是很有必要的,需要的朋友可以參考下2023-11-11
Android巧用Fragment解耦onActivityResult詳解
這篇文章主要給大家介紹了關(guān)于Android巧用Fragment解耦onActivityResult的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2018-08-08
Android基于ListView實現(xiàn)類似Market分頁加載效果示例
這篇文章主要介紹了Android基于ListView實現(xiàn)類似Market分頁加載效果,結(jié)合完整實例形式分析了ListView的OnScroll方法來實現(xiàn)分頁與滾動加載的操作步驟與相關(guān)實現(xiàn)技巧,需要的朋友可以參考下2016-10-10
Android便攜式熱點的開啟狀態(tài)檢測和SSID的獲取方法
WIFI熱點的開啟狀態(tài)和開啟后的SSID如何獲取呢?接下來通過本文給大家分享Android便攜式熱點的開啟狀態(tài)檢測和SSID的獲取方法,需要的朋友參考下吧2017-01-01
Android library native調(diào)試代碼遇到的問題解決
這篇文章主要介紹了Android library native 代碼不能調(diào)試解決方法匯總,android native開發(fā)會碰到native代碼無法調(diào)試問題,而app主工程中的native代碼是可以調(diào)試的2023-04-04
Android PopupWindow實現(xiàn)微信右上角的彈出菜單
這篇文章主要為大家詳細(xì)介紹了Android PopupWindow實現(xiàn)微信右上角的彈出菜單,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-04-04

