Alberto Rossi
Alberto Rossi

Reputation: 1800

Android WebPage does not refresh its content

I have an android app with this code:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    mWebView = (WebView) findViewById(R.id.webview);  
    mWebView.getSettings().setJavaScriptEnabled(true);  
    mWebView.getSettings().setLoadsImagesAutomatically(true);          
    mWebView.setWebViewClient(new WebViewClient());  
    mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    mWebView.setScrollbarFadingEnabled(false);
    mWebView.loadUrl(url);
}

The WebView opens me the ABC.html page correctly. When I edit the ABC.html page and I open it again using my device, I don't see the new updates I made. It still loads the old page. I added this line:

    mWebView.reload();

But the WebView loads the old page again. What can I do?

Upvotes: 0

Views: 125

Answers (1)

Frank
Frank

Reputation: 12300

try:

mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

and maybe also

mWebView.getSettings().setAppCacheEnabled(false);

although this last line should not matter.

Upvotes: 1

Related Questions