Android 本地存储在应用程序重新启动后随机更改
Api 14。我有这个简单的设置Android 本地存储在应用程序重新启动后随机更改,android,android-webview,local-storage,Android,Android Webview,Local Storage,Api 14。我有这个简单的设置 WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setLoadWithOverviewMode(true); webSettings.setUseWideViewPort(false); webSettings.setDatabasePath(webView.getCon
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setUseWideViewPort(false);
webSettings.setDatabasePath(webView.getContext().getDir("databases",
Context.MODE_PRIVATE).getPath());
webSettings.setAllowContentAccess(true);
webSettings.setAllowFileAccess(true);
webSettings.setDomStorageEnabled(true);
webSettings.setDatabaseEnabled(true);
我在本地存储中存储了一些值
localStorage.musicVolume
第一次运行应用程序时,我将musicVolume设置为7
我有呼叫系统的关闭按钮。退出(1);
因此,我可以重新启动应用程序几次没有任何问题,musicVolume恢复为7。
但有一次musicVolume为0,所以我将其设置为3。
现在我遇到了一个奇怪的情况,在重新启动后,musicValue可以恢复为3或7。看起来同一个应用程序有两个localstorage。
有什么办法可以解决吗?为什么不使用SharedReferences?这是一个已经使用localStorage的web应用程序