codenameone - Download image and replace it in Resources -


i have .jpg image, used in theme, piece of code can change theme

hashtable h = new hashtable(); h.put("bgimage", fetchresourcefile().getimage("black.png")); uimanager.getinstance().addthemeprops(h); f.refreshtheme(); 

and download image url image same name (blank.png) , replace it. theme automatically changed after next running of app.

i have tried this, wants component parameter , second method wants placeholder (encodedimage, not sure purpose) , don´t know if image automatically replaced in resources.

imagedownloadservice.createimagetostorage(url_image_online, button,  "online-1020x1440.jpg", dimension)  urlimage.createtostorage(encodedimage placeholder, string storagefile, string url, urlimage.imageadapter adapter) 

replacing in theme hash bit when can change image in style object , avoid lot of complexities.

the download services in background , update target component when done, since don't have component here not work. can download file synchronously load theme using util.downloadtostorage/filesystem need block until completes since need complete image.

you can download new resource file or myriad of other things if explain use case.


Comments