WebView not reflecting changes to web page contents

  • Replies:0
Anuj Sharma
  • Forum posts: 1

Oct 26, 2017, 12:36:29 PM via Website

I have a web application running on an AWS and an Android app which is just a WebView to just reflect the web application.

I had the setAppCacheEnabled set to True earlier, but I commented that piece of code in the recent version of the application.

Anytime an update is made to the web page contents, the change does not reflect on the Android WebView.

Below is a snippet of the code:

    setContentView(R.layout.activity_main);
    myWebView = (WebView)findViewById(R.id.webView);
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    //improve  webView performance
    myWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
    myWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    //myWebView.getSettings().setAppCacheEnabled(true);
    myWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webSettings.setDomStorageEnabled(true);
    webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
    webSettings.setUseWideViewPort(true);
    webSettings.setSaveFormData(true);
    webSettings.setSavePassword(true);
    webSettings.setEnableSmoothTransition(true);

    myWebView.loadUrl(<my web application URL>;);
    myWebView.setWebViewClient(new WebViewClient());

Reply