Open GoogleCodeExporter opened 9 years ago
The only workaround I've found so far is to delete sl4a's data in
settings>applications>sl4a. Not ideal for obvious reasons.
Original comment by business...@gmail.com
on 22 Mar 2011 at 2:56
I have the same problems..
I'd like to clear the cache of webview programmatically but can't find a clear
way to do that with SL4A. There exists code to wash the cache in java but not
python apparently.. does someone as a solution in python we didn't see?
Thanks
Lio
Original comment by lio.chi...@gmail.com
on 28 Dec 2011 at 3:53
I solved this in a programmatic way. With python sl4a, if the 'same' webview
is opened (ie: samefile.html), it will display the previous cached page, which
is not good if you change the page code, such as viewing an image jpg, then
viewing a new image jpg. With apps built on sl4a, webviews are the only real
useable user interface. I tried having the script name a new page (ie:
newfile1.html; newfile2.html; ...) but still the old cached jpg image was used.
in my app, i display a number of images to the user ina webview, updating the
jpg image in the html code each view. I solved this by ALSO changing the jpg
names (ie: jpg1.jpg; jpg2.jpg; ...)
To do this:
import random
randomPageName=random.randrange(0,100)
randomJpgName=random.randrange(0,100)
htmlPage=open('//file'+str(randomPageName)+'.html','wb')
htmlPage.write('<html><body><img
src="jpg'+str(randomJpgName)+'.jpg"/></body></html>')
htmlPage.close()
droid.webViewShow('//file'+str(randomPageName)+'.html')
..get the idea?
further to this, i delete the folder i use for the app upon exiting the script:
import shutil
shutil.rmtree('/sdcard/MyAppFolder')
mypath=('/sdcard/MyAppFolder')
...then to make your folder again:
import os.path
if not os.path.isdir(mypath):
os.makedirs(mypath)
Cheers:)
and please have a look at my apps:
https://play.google.com/store/apps/developer?id=FineLineLabs
Original comment by MichaelD...@gmail.com
on 24 Oct 2012 at 2:51
Original issue reported on code.google.com by
business...@gmail.com
on 21 Mar 2011 at 3:56