android 中 webview 怎么用 localStorage
更新时间:2015年07月05日 10:55:50 投稿:hebedich
这篇文章主要介绍了android 中 webview 怎么用 localStorage方法的相关资料,需要的朋友可以参考下
我在 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巧用Fragment解耦onActivityResult详解
这篇文章主要给大家介绍了关于Android巧用Fragment解耦onActivityResult的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2018-08-08
Android基于ListView实现类似Market分页加载效果示例
这篇文章主要介绍了Android基于ListView实现类似Market分页加载效果,结合完整实例形式分析了ListView的OnScroll方法来实现分页与滚动加载的操作步骤与相关实现技巧,需要的朋友可以参考下2016-10-10
Android library native调试代码遇到的问题解决
这篇文章主要介绍了Android library native 代码不能调试解决方法汇总,android native开发会碰到native代码无法调试问题,而app主工程中的native代码是可以调试的2023-04-04
Android PopupWindow实现微信右上角的弹出菜单
这篇文章主要为大家详细介绍了Android PopupWindow实现微信右上角的弹出菜单,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2018-04-04


最新评论