0

I have a webView in that displaying the contents which is crawl from web. and some time it's appear the previous displayed info/data not new one even-though I am entering different roll number then after some times it's display the previous displayed data ... what is the reason and how to solve, please help me to solve this problem.

To clear the webview info ,data,history I have used these methods then after same problem.

web_view.clearView();
web_view.clearHistory();
web_view.clearFormData();
web_view.clearCache(true);
web_view.clearAnimation();

code:

web_view.clearView();
web_view.clearHistory();
web_view.clearFormData();
web_view.clearCache(true);
web_view.clearAnimation();

if(result!=null&&result.length()>0) {
    web_view.setVisibility(View.VISIBLE);
    web_view.startAnimation(animation);
    lv.setVisibility(View.GONE);

    web_view.loadData(result, "text/html", null);
    web_view.setBackgroundColor(0x00000000);
    Vibrator vibe = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vibe.vibrate(100);
}
Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
Abdul Rizwan
  • 3,904
  • 32
  • 31
  • clear webview history inside `onPageFinished();` event of `WebViewClient`. – Jibran Khan May 19 '15 at 10:19
  • How to use ? can you give an example? – Abdul Rizwan May 19 '15 at 10:24
  • Have a look http://stackoverflow.com/questions/8103532/how-to-clear-webview-history-in-android – Jibran Khan May 19 '15 at 10:25
  • it's not working...actually here I have crawl some info using asyncTask background method and returning String html data ...and then these data just displaying adding into webView to display the content based on html ... – Abdul Rizwan May 19 '15 at 10:43
  • did you tried clearing cache after webview is loaded ? `AsyncTask` is asynchronous therefore, clearing cache during page load will not work – Jibran Khan May 19 '15 at 10:46
  • Print your result in logCat and see, it may be null, thats why your code is not running and showing previous data. – Assad May 19 '15 at 10:49
  • I have printed in log cat...it's displaying the different info based on my search...but in webview some time it's displaying previous data...its not displaying as it's displaying in logCat... – Abdul Rizwan May 19 '15 at 11:42

0 Answers0