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编程使用HTTP协议与TCP协议实现上传文件的方法
这篇文章主要介绍了Android编程使用HTTP协议与TCP协议实现上传文件的方法,结合实例形式较为详细的分析了Android使用HTTP协议与TCP协议的具体步骤与实现文件传输的相关技巧,需要的朋友可以参考下2016-01-01在当前Activity之上创建悬浮view之WindowManager悬浮窗效果
这篇文章主要介绍了在当前Activity之上创建悬浮view之WindowManager悬浮窗效果的相关资料,需要的朋友可以参考下2016-01-01
最新评论