1. Are you ready for the Galaxy S20? Here is everything we know so far!

How to clear cache for WebView?

Discussion in 'Android Development' started by DarkAgent2005, Jan 10, 2016.

  1. DarkAgent2005

    DarkAgent2005 Lurker
    Thread Starter

    Hello,

    I have an Android app that uses WebView to display my website. I want to make it so that whenever the app is closed or stopped being used, the app clear's WebView's cache of HTML files. Currently, I have the following code which clears *all* cache but I only want to clear a specific type of files from the cache (i.e. HTML files):

    @override
    protected void onStop(){
    super.onStop();
    browser.clearCache(true);
    }

    @override
    protected void onDestroy() {
    super.onDestroy();
    browser.clearCache(true);
    }​

    Any way for me to only clear a specific type of file from cache? Thanks!
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - clear cache WebView
  1. kayakkielbasa
    Replies:
    8
    Views:
    1,246
  2. ironass
    Replies:
    1
    Views:
    1,350
  3. OmTec Web
    Replies:
    0
    Views:
    638
  4. factchaser
    Replies:
    7
    Views:
    2,385
  5. AngryCAT60
    Replies:
    2
    Views:
    687
  6. prince214
    Replies:
    6
    Views:
    3,178
  7. Jeff Whiteis
    Replies:
    1
    Views:
    3,173
  8. Provasek
    Replies:
    5
    Views:
    3,453
  9. Andy Perrett
    Replies:
    5
    Views:
    1,149
  10. petecal
    Replies:
    0
    Views:
    2,436

Share This Page

Loading...