Sign in to follow this  

Loading a png image

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 this post

Link to post
Share on other sites
You probably just need to add a leading slash:

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).


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this