T
T
tim_moor2021-02-03 13:29:03
Android
tim_moor, 2021-02-03 13:29:03

How to disable cache WebView?

Good afternoon!
In my project I am using a WebView to display information. Here is a code snippet:

String mainBody = getIntent().getStringExtra(EXTRA_MAIN_BODY_TEACH);
        WebView webView = findViewById(R.id.wv_teach_info);
        webView.getSettings().setAppCacheEnabled(false);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.loadDataWithBaseURL(null, mainBody, "text/html", "UTF-8", null);

To disable the cache, I use lines 3 and 4, but this code does not get rid of caching.
What am I doing wrong? How to disable the cache?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question