手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android 中 webview 怎么用 localStorage
android 中 webview 怎么用 localStorage
摘要:这篇文章主要介绍了android中webview怎么用localStorage方法的相关资料,需要的朋友可以参考下我在android里面使用...

这篇文章主要介绍了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 中 webview 怎么用 localStorage】相关文章:

Android Thread 介绍与实例

基于Android中的 AutoCompleteTextView实现自动填充

Android中Webview自适应屏幕

Android开发笔记之:一分钟学会使用Logcat调试程序的详解

android中查看项目数字证书的两种方法

android imageview图片居中技巧应用

android平台中调用系统界面

Android自定义Custom Dialog对话框

android二级listview列表实现代码

Android主流屏幕分辨率介绍

精品推荐
分类导航