手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android 中 webview 怎么用 localStorage
android 中 webview 怎么用 localStorage
摘要:我在android里面使用html5的localStorage为什么存不进去也读不出来呀?网上搜了好多都没效果mainWebView...

我在 android里面 使用html5的 localStorage

为什么存不进去也读不出来呀?

网上搜了好多都没效果

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);

这个测试了是可以的

【android 中 webview 怎么用 localStorage】相关文章:

Android UI开发专题(一) 之界面设计

Android中的Shape和Selector的结合使用

Android中Webview自适应屏幕

Android开发:控件之WebView

android开发中常用的Eclipse快捷键详细整理

Android 开发中怎么使用自定义字体

Android自定义Custom Dialog对话框

android:descendantFocusability方法介绍

android中可以通过两种方式调用接口发送短信

在android settings.db数据库中添加一项新的设置

精品推荐
分类导航