Android Question WebView caching problems

Pesciolina

Active Member
Licensed User
Longtime User
in an old application I still use webview to view the data of the Sqlite db and lately with some devices it doesn't display anything.
To be able to view I have to exit the App and clear the chace.

Could I solve the problem with this function that I found in the forum?

B4X:
Dim o As Reflector
o.Target = MapViewer
o.RunMethod2("clearCache","True","java.lang.boolean")

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Unsufficient information. Even to guess anything.
Upload a small project showing the problem.
 
Upvote 0

Pesciolina

Active Member
Licensed User
Longtime User
this problem only happens to me with Blackview branded phones, it has never happened to me in development
 
Upvote 0

Pesciolina

Active Member
Licensed User
Longtime User
Don, you are right but I honestly don't know how to reproduce the problem.
What they point out to me is that the webview screen is completely white.
This is the procedure I use to populate it
B4X:
Sub Globals
Public MapViewer As WebView
End sub
Sub Activity_Create(FirstTime As Boolean
MapViewer.Initialize("MapViewer")
End sub

Sub FillWebView
Private Query As String
Query = "SELECT * FROM TblTempi"
MapViewer.LoadHtml(DbUtils.ExecuteHtml(Starter.SQL1, Query, Null  , 0  , False ) )

End sub
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
You can also try adding this code that uses webview extras to turn off caching in a webview:

B4X:
Dim wvs as WebViewSetings
Dim wv as Webview

wvs.setCacheMode(wv,"LOAD_NO_CACHE")
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Based on #5 my guess that he does not see any webview in his activity. Instead he´s looking at an Empty Activity with no layout (and NO Webview loaded)
Ah, that'll do it.
 
Upvote 0
Top