Results 1 to 1 of 1
Thread: Clear webview cache?
- 10-29-2012, 10:14 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 1
- Rep Power
- 0
Clear webview cache?
So my goal is to clear the cache of a webview, named myWebView, before I use it. I originally tried myWebView.clearCache(true); but that didn't work. So after I did some searching online I found someone that used Context.deleteDatabase("webview.db"); and Context.deleteDatabase("webviewCache.db"); only when I use it I get the error:
I've searched for an answer but found nothing so I'd be very grateful for some help.Java Code:Description Resource Path Location Type Cannot make a static reference to the non-static method deleteDatabase(String) from the type Context MainActivity.java /test/src/com/example/test line 30 Java Problem
Here's the main piece of the code:
Java Code:private WebView myWebView; private Button btn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myWebView.clearHistory(); myWebView.clearFormData(); //clear cache code that causes problem Context.deleteDatabase("webview.db"); Context.deleteDatabase("webviewCache.db"); myWebView = (WebView) findViewById(R.id.webView1); btn = (Button)findViewById(R.id.button1); btn.setOnClickListener(bClickList); WebSettings webSetts = myWebView.getSettings(); myWebView.setWebViewClient(new WebViewClient()); webSetts.setJavaScriptEnabled(true); myWebView.loadUrl("http://google.com/"); }
Similar Threads
-
Clear InputStream Cache
By hotsauce1183 in forum Advanced JavaReplies: 2Last Post: 02-08-2011, 05:26 PM -
How to clear cache of an Applet/JApplet
By tanmoy.b81 in forum AWT / SwingReplies: 0Last Post: 08-11-2008, 11:54 AM -
clear cache
By Jadellll in forum New To JavaReplies: 0Last Post: 03-20-2008, 09:27 AM -
JSP - using connection cache
By Java Tip in forum Java TipReplies: 0Last Post: 01-30-2008, 09:54 AM -
Caché Monitor 0.35
By levent in forum Java SoftwareReplies: 0Last Post: 06-10-2007, 01:40 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks