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

这个测试了是可以的

更多相关文章

  1. 在Ubuntu12.10-32bit上构建、测试WebRTC之Android示例WebRTCDemo
  2. Android(安卓)修改系统时区导致SimpleDateFormat无法输出正确时
  3. Android(安卓)SDK Manager更新 != 问题解决方法
  4. android实现系统的返回键和home键
  5. Android(安卓)设置TextView滑动滚动条和滑动效果
  6. Android(安卓)6.0运行时权限解决方案
  7. Android(安卓)开源项目分类汇总
  8. Android仿京东分类模块左侧分类条目效果
  9. Android(安卓)UI开源框架

随机推荐

  1. Android(安卓)Java生成随机数的方法
  2. 更新Android(安卓)SDK 出错 Failed to re
  3. 1.Ubuntu下Android(安卓)studio配置
  4. Android(安卓)Launcher源码研究(二) 加载
  5. Android(安卓)通过配置 productFlavors
  6. Android(安卓)启动界面 点击按钮跳转和3
  7. TextView自定义跑马灯效果
  8. Appium的一点一滴:Android(安卓)KEYCODE
  9. android 中断点续传理解
  10. android的TextView在设置ellipsize可能显