Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android studio 需要制作没有用户数据存储的WebView应用程序_Android Studio - Fatal编程技术网

Android studio 需要制作没有用户数据存储的WebView应用程序

Android studio 需要制作没有用户数据存储的WebView应用程序,android-studio,Android Studio,我不会假装我擅长应用程序开发。我过去只有一些基本的经验,主要是在webdev方面,这让我能够在androidstudio中为自己的使用做一些非常基本的事情,通常是通过反复试验 现在,我需要在我的平板电脑上制作一个小型WebView应用程序,以打开一个所有平板电脑用户都可以登录的网站,当他们退出该应用程序时,绝对不会存储任何用户数据。我想让这个应用程序表现得好像每次都是第一次使用一样 到目前为止,我有时能成功,但不是每次都能成功。问题是用户数据正在被存储。这与缓存无关,因为删除缓存没有帮助,而清除

我不会假装我擅长应用程序开发。我过去只有一些基本的经验,主要是在webdev方面,这让我能够在androidstudio中为自己的使用做一些非常基本的事情,通常是通过反复试验

现在,我需要在我的平板电脑上制作一个小型WebView应用程序,以打开一个所有平板电脑用户都可以登录的网站,当他们退出该应用程序时,绝对不会存储任何用户数据。我想让这个应用程序表现得好像每次都是第一次使用一样

到目前为止,我有时能成功,但不是每次都能成功。问题是用户数据正在被存储。这与缓存无关,因为删除缓存没有帮助,而清除用户数据有帮助

如何停止存储用户数据,或确保每次关闭应用程序时都将其删除

到目前为止,我的代码是:

活动\u main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <WebView
        android:id="@+id/dhwebx"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="0dp"
        android:autoLink="web"
        android:linksClickable="true"     />

</androidx.constraintlayout.widget.ConstraintLayout>
谢谢你的帮助。谢谢

package com.example.appname;

import androidx.appcompat.app.AppCompatActivity;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final WebView dhweb = (WebView) findViewById(R.id.dhwebx);
        dhweb.setWebViewClient(new WebViewClient());
        dhweb.clearCache(true);
        dhweb.clearHistory();
        dhweb.getSettings().setAppCacheEnabled(false);
        dhweb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        dhweb.getSettings().setJavaScriptEnabled(true);
        dhweb.loadUrl("my url here");

    }

}