Images work in toolkit but not on phone

Here's the code I'm using

try

{

image = Image.createImage("/duke2.png");

}

catch (Exception error)

{

Alert alert =new Alert("Failure",

"Can't open image file.", null,null);

alert.setTimeout(Alert.FOREVER);

display.setCurrent(alert);

}

}

protectedvoid paint(Graphics graphics)

{

if (image !=null)

{

graphics.drawImage(image, 50, 50,

Graphics.VCENTER | Graphics.HCENTER);

}

}

I found it online, though I've tried several others I found and none of them work either. It works fine when I run it in the toolkit, but when I try it on my phone which is an audiovoxx smt5600, it comes up with exception and displays can't open image. It also only displays the alert for a split second before going to a blank screen, when I think it should leave it up. Thanks for any help.

[1482 byte] By [tyler9768a] at [2007-11-26 12:48:05]
# 1
Try to get the error message in the Alert, using something likeAlert alert = new Alert("Failure", error.getMessage(), null, null); inside your catch block.Mihai
Printisora at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
please make sure that the file name case is correct, as on the toolkit the letters are not case sensitive, but on the phone hey are.
aromra at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Thanks for the replies. I did check the case of the file and it appears to be all lower as in the code. I also added the alert in that was suggested, but as I mentioned the alert flashes very quickly and I can't read what it says. The other one I was able to because I knew the words I was looking for, this one I can't make out any or even if there are any.

tyler9768a at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
Try putting the Alert in a separate thread and try again.Mihai
Printisora at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

i am also getting same problem

Image.createImage works fine in nokia but in samsung d500 it is unable to find the image.i have tried all formats ie jpeg,gig,png but noone worked

I am creating image like this

Image abc=Image.createImage("/images/abc.png")

any suggestion plz help

harrriiiia at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6
sorry it took so long to get back to you, I'm new at this. The error message appears to just say "null" Thanks!
tyler9768a at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7
After going through 130 something pages of the forum I found the answer in another thread. it is the file extensions being case sensitive on my phone and not in the emulator. Apparently they are not .png, but .PNG. Thanks for your help everyone.
tyler9768a at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 8
hityler9768 but my d500 is still not able to find the imagecan help me out thanks
harrriiiia at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 9

sorry, I'm pretty new at this too. My only suggestion is to check through the forum there are thousands of posts here someone else might have your problem. If you haven't tried searching, use that feature with your phone's name.

When I was re-reading the thread to see your original message I also reread armor's (or something I can't see the screenname on this screen) reply and realize he gave me the answer. When I read his originally I checked the file name, but not the extension which doesn't show on my computer. At any rate I gave him the duke dollars thanks!

tyler9768a at 2007-7-7 16:30:45 > top of Java-index,Java Mobility Forums,Java ME Technologies...