• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem with WebView caching result

Hey all,

This problem has been killing me for a few days, I've tried searching the web and so far I've come up with not much.

I've got a widget which uses a WebView to load a page from a URL and read the contents of the page. The reason for the WebView is that I need to emulate the browser in order to get the page to display the content, a HttpGet won't get it back (reliably).

None the less, at some point the WebView stops loading new content and appears to keep loading a cached page instead. In the code it appears to have gone to the web to get a new page but what is returned is old data.

Those with the Android 2.2 build get a new button for applications in the settings area which allows them to clear the App Data. Doing this blows away whatever cached data the WebView is using and it starts to work again.

So what I would like to do is programmatically blow this App Data away. Only problem is that I have no idea what data it is. I'm not explicitly make it anywhere in my app, the WebView control appears to be making it itself. Would anyone know what is going on here and how I can avoid it?

I've turned all caching off (in every way), it had no effect.

Code:
        browser = new WebView(context);
        browser.getSettings().setJavaScriptEnabled(true);
        browser.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        browser.setDrawingCacheEnabled(false);
        browser.clearCache(true);
        browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
        browser.setWebViewClient(new TelstraWebViewClient());
        browser.loadUrl(URL);
Cheers
 
Back
Top Bottom