## Recommended Posts

Hello to all! Seeing that there isn't a thread already made regarding my problem. Its rather simple for you guys really. I was wondering how to load a png image properly. What I'm doing is...
image = Image.createImage("[name of image].png");
Well.. that definately doesn't work. Can anyone help me on this? Thanks in advance

##### Share on other sites
image = Image.createImage("/[name of image].png");

That being said, depending on your build process the images might end up in a different place than the root directory, so it's useful to open up the jar you create and check the exact location of the image and adjust the path in createImage() according to that.
One last thing, the filenames on phones are case-sensitive so you have to make sure the names you use are exactly the same (pic.png!=pic.PNG).

shmoove

##### Share on other sites
drat! Why didn't I think of that in the first place... So embarassed. Well... the images are in the same directory as the source files so I assumed that there would be no need for "/"

##### Share on other sites
Most people have problems with that (i did!). I think it's an API flaw. The programmers shouldn't have to type that leading slash...

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628389
• Total Posts
2982410

• 10
• 9
• 19
• 24
• 11