I'm trying to run the 14.1 example on page 503. I am trying to test the application using a Palm OS emulator. I have put System.out statments letting me know where I get the an error. The error is at statement "im = Image.createImage(imageData,0,imageData.length);" I get an "java.lang.IllegalArgumentException" error........Can someone help. I have tried length -1 but still no luck.......
posted 15 years ago
From the MIDP documentation, Image.createImage() throws IllegalArgumentException - if imageData is incorrectly formatted or otherwise cannot be decoded So, either your array is not a "byte" array or it is not formatted to PNG image format.
Does the image load if you are not trying to download the file over a network? That is, package the png file inside the JAR and access from there. If it is a network problem, depending on the Palm you have, you may try changing the procotol to inethttp (replace http:// with inethttp://) John Core J2ME
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads