1

Possible Duplicate:
WebView load website when online, load local file when offline

I want to view website in cache ie in offline mode. I tried, but it fails in offline

showing "www.google.com" webpage not availabe. Generally the use of cache is to show the

webpage temporarily in offline. But I couldnt find the solution.Please help me. My code is as follows:

{ wt=(WebView)findViewById(R.id.webViewt);
  wt.getSettings().setAppCacheMaxSize(1024*1024*8);
  wt.getSettings().setAppCachePath("/data/data/"+ getPackageName() +"/cache");
  wt.getSettings().setAllowFileAccess(true);
  wt.getSettings().setAppCacheEnabled(true);
  wt.getSettings().setJavaScriptEnabled(true);
  wt.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
  wt.loadUrl("http://www.google.com");  
  }                                                                                   
Community
  • 1
  • 1
Shadow
  • 6,864
  • 6
  • 44
  • 93
  • I've just answered a duplicate of your question over here: [WebView load website when online, load local file when offline][1] [1]: http://stackoverflow.com/a/14671256/1427177 – jenzz Feb 03 '13 at 09:55

0 Answers0