Downloading image to label automatically

14 views
Skip to first unread message

Gareth Murfin

unread,
Mar 28, 2019, 10:38:00 AM3/28/19
to CodenameOne Discussions

I want to be able to download an image and then have it appear in the label automatically when its ready, so Im using this:
 
setIconOnMe.setIcon(URLImage.createToStorage(placeHolder, url, url, URLImage.RESIZE_SCALE));  

but it doesnt seem to set the image when it comes in? It works fine if I revisit the form, but I expected it to download then set automatically, should it ?

Shai Almog

unread,
Mar 28, 2019, 11:20:49 PM3/28/19
to CodenameOne Discussions
That should work but you used the URL and image name as the same value. Did you make changes to the animation behavior used to refresh the placeholder?

Gareth Murfin

unread,
Mar 29, 2019, 10:32:45 AM3/29/19
to CodenameOne Discussions
No I didnt do anything like that, just ordinary usage. Is there an event when the image is downloaded I can tap into to try and do it there?

As for url as name, doesnt seem to matter, this only fails the very first time it is downloaded, from then on since it exists its set right away.

Shai Almog

unread,
Mar 30, 2019, 1:35:16 AM3/30/19
to CodenameOne Discussions
There is no event for download. Try creating a hello world with a label/URL image and see if that works. Then try to reproduce the problem you're experiencing.
Reply all
Reply to author
Forward
0 new messages