• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CoreJ2Me Book examples

 
Trever Donta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.......
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
john muchow
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic