| Author |
exception with ImageItem
|
Ajeesh Moidutty
Greenhorn
Joined: May 18, 2006
Posts: 22
|
|
i used this code : //////////////////// import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class ImmutableImageFromFile extends MIDlet implements CommandListener { private Display display; private Form fmMain; private Command cmExit; public ImmutableImageFromFile() { display = Display.getDisplay(this); cmExit = new Command("Exit", Command.EXIT, 0); fmMain = new Form(""); fmMain.addCommand(cmExit); fmMain.setCommandListener(this); try { Image im = Image.createImage("1.jpg"); fmMain.append(new ImageItem("asd", im,ImageItem.LAYOUT_DEFAULT, "asdf")); display.setCurrent(fmMain); } catch (java.io.IOException e) { e.printStackTrace(); } } public void startApp() { display.setCurrent(fmMain); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable s) { if (c == cmExit) { destroyApp(false); notifyDestroyed(); } } } \\\\\\\\\\\\\\\ on running it i got this exception : /////////////// java.io.IOException at javax.microedition.lcdui.ImmutableImage.getImageFromStream(+15) at javax.microedition.lcdui.ImmutableImage.<init>(+20) at javax.microedition.lcdui.Image.createImage(+8) at ImmutableImageFromFile.<init>(+75) at java.lang.Class.runCustomCode(+0) at com.sun.midp.midlet.MIDletState.createMIDlet(+19) at com.sun.midp.midlet.Selector.run(+22) //////////////// What does that mean?
|
 |
Koh Khai Huat
Ranch Hand
Joined: Aug 05, 2005
Posts: 100
|
|
Hi Ajeesh Moidutty, java.io.IOException at javax.microedition.lcdui.ImmutableImage.getImageFromStream(+15) at javax.microedition.lcdui.ImmutableImage.<init>(+20) at javax.microedition.lcdui.Image.createImage(+8) at ImmutableImageFromFile.<init>(+75) at java.lang.Class.runCustomCode(+0) at com.sun.midp.midlet.MIDletState.createMIDlet(+19) at com.sun.midp.midlet.Selector.run(+22) the error above mean that the input / output of the program had an exception which may point to the image file that the program is loading may not be found check if the image is found or not rgards Khai Huat
|
if (!WorkHard){
System.out.println("Fail!!!");
}
|
 |
Rush IT
Greenhorn
Joined: Nov 26, 2007
Posts: 2
|
|
|
Try with png image instead of .jpg
|
 |
 |
|
|
subject: exception with ImageItem
|
|
|