Namespaces
Variants
Actions

How to read an image file from the JAR

Jump to: navigation, search
SignpostIcon Palette 52.png
Article Metadata

Article
Created: firt (15 Apr 2007)
Last edited: hamishwillee (23 Jan 2012)

To read an image file from the JAR to an Image object, you should use this code:

try {
Image logo = Image.createImage("/path_to_the_image");
}
catch (java.io.IOException e) {
System.err.println("Image read error");
}

Remember:

  • You must use the first slash "/" to refer to the root of the JAR file.
  • You must include the image in the project to be included in the JAR file by the IDE you are using.
  • To be 100% standard to all devices, the image should be in PNG format. Many Nokia devices supports GIF, JPG and BMP to.
This page was last modified on 23 January 2012, at 08:20.
95 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved