Code with Benji
Code with Benji

Reputation: 715

error on loading url images in codename one app how can i solve this

Exception: java.lang.IllegalArgumentException - create image failed for the given image data of length: 1420

 EncodedImage placeholder = (EncodedImage) initForm.theme.getImage("avater.png");
        icon1 = URLImage.createToStorage(placeholder, "tyrion",  "https://www.dropbox.com/s/52tu8jkqg1pikvw/jpeg?dl=1");

Upvotes: 1

Views: 42

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

This seems to be a connectivity issue. I looked at the file and it's a 16k file yet you downloaded only 1,420 bytes so you got an error. I'm guessing that the link is redirecting and we get an HTML error page which is what you see.

It's also possible that this failed to you once and you're now still looking at the cached failed download.

The downloaded file should be in your .cn1 directory (assuming this is on the simulator) under the name "tyrion". First try to just delete it.

If this doesn't help look at it's contents, it could be an HTML error file.

Upvotes: 1

Related Questions