I went through the documentation: https://www.codenameone.com/javadoc/com/codename1/ui/URLImage.html#fetch
By default an image is fetched lazily as it is asked for by the GUI unless the fetch() method is invoked in which case the IO code is executed immediately.
It looks like the storage file is not getting refreshed after fetch() is invoked. Here is the test I ran
1) I create a URLImage the first time with the following image: "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
2) I run the application. The image is well displayed
3) I re run the application with a new URL image "http://awoiaf.westeros.org/images/thumb/9/93/AGameOfThrones.jpg/400px-AGameOfThrones.jpg" , but I still see the previous image although fetch() is being called!
Form hi = new Form("Hi World");
EncodedImage placeholder = EncodedImage.createFromImage(Image.createImage(hi.getWidth(), hi.getWidth() / 5, 0xffff0000), true);
URLImage background = URLImage.createToStorage(placeholder, "400px-AGameOfThrones.jpg",
"https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");
background.fetch();
Label label = new Label();
label.setIcon(background);
hi.addComponent(label);
hi.show();
Second run:
Form hi = new Form("Hi World");
EncodedImage placeholder = EncodedImage.createFromImage(Image.createImage(hi.getWidth(), hi.getWidth() / 5, 0xffff0000), true);
URLImage background = URLImage.createToStorage(placeholder, "400px-AGameOfThrones.jpg",
"http://awoiaf.westeros.org/images/thumb/9/93/AGameOfThrones.jpg/400px-AGameOfThrones.jpg");
background.fetch();
Label label = new Label();
label.setIcon(background);
hi.addComponent(label);
hi.show();