tags:

views:

92

answers:

3

I wrote this code for my j2me project.

try { Image immutableThumb = Image.createImage( temp, 0, temp.length); } catch (Exception ex) { System.out.println(ex); }

where temp is a byte array. When I tried it for localhost it works,& image is get created. But when I tried it on LAN it shows the exception, illegalArgumentException. Image does'nt created. How can I solve the problem?

+1  A: 

The docs say

IllegalArgumentException - if imageData is incorrectly formatted or otherwise cannot be decoded

so I'd say you're getting a different byte array.

Stephen Denne
A: 

If you get the byte array from a network location, be sure it came from a supported image type. I mean, not every image format is available on MIDP. To be sure, you can use PNG.

Stefano Driussi
A: 

Is it on device or in emulator that you are having a problem? It could be the url string, or a problem with the connection.

Can you post all your source code?

Here's a simple example: how to download an image from a web-server.