Clear Webview Cache

admac231

Active Member
Licensed User
Longtime User
I was wondering if this is at all possible?

I've tried using the reflection library but it throws up a NoSuchMethod error for the clearCache method. Other methods run successfully so I really don't know why it isn't working.

B4X:
Dim Obj1 As Reflector

Obj1.Target = WebView1

Obj1.RunMethod2("clearCache","False","java.lang.Boolean")

Am I overlooking something stupid here or is there a reason this can't be done?

Thanks in advance for any help!
 

agraham

Expert
Licensed User
Longtime User
Am I overlooking something stupid here!
Yes! You are defining a clearCache method with a parameter of type "java.lang.Boolean" which is a true Object that is a boxed boolean. The paramater type you need is a boolean primitive "java.lang.boolean". See the list of types Basic4android - Reflection
 
Upvote 0

admac231

Active Member
Licensed User
Longtime User
Sorry to bring this up again but it would seem that the clearCache() method is very temperamental. As in sometimes it works and sometimes it doesn't. I really don't know what's causing it to stop working.

In addition, I've tried clearing out the webviewCache folder created in DirInternalCache but this also doesn't seem to do anything. Argh.
 
Upvote 0
Top