Location of Images in a compiled J2ME program

what is the exact defination for image folder in mobile development ap

Page 1 of 1

3 Replies - 3213 Views - Last Post: 03 June 2009 - 10:46 AM

#1 shwetha shetty  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-March 09

Location of Images in a compiled J2ME program

Posted 31 March 2009 - 07:45 AM

what is exactly image folder in mobile development application?
Is This A Good Question/Topic? 0
  • +

Replies To: Location of Images in a compiled J2ME program

#2 markhazlett9  Icon User is offline

  • Coding is a lifestyle
  • member icon

Reputation: 60
  • View blog
  • Posts: 1,666
  • Joined: 12-July 08

Re: Location of Images in a compiled J2ME program

Posted 31 March 2009 - 10:41 AM

I'm confused... please be more specific with your question and provide more details.
Was This Post Helpful? 0
  • +
  • -

#3 garytkm89  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 8
  • Joined: 28-February 09

Re: Location of Images in a compiled J2ME program

Posted 01 June 2009 - 11:57 PM

Hi, I'm stuck here. I wanted to load the picture of ice.jpeg into my midlet but the problem I'm facing is where should i keep the picture in order for me to load the image into midlet. I tried putting C:\ice.jpeg instead of ice.jpeg
but i'm still getting error. Is there anyone to point out my mistake. Helps will be kindly appreciated.


import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class AppendImage extends MIDlet{
  private Display display;
  private FormClass form;
  private MIDlet midlet;

  protected void startApp(){
	form = new FormClass("Form Created", this);
	display = Display.getDisplay(this);
	display.setCurrent(form);
  }

  protected void pauseApp(){}

  protected void destroyApp(boolean unconditional){}

  class FormClass extends Form implements CommandListener{
	private Command exit;
	private Image image;

	public FormClass(String title, MIDlet items){
	  super(title);
	  midlet = items;
	  try{
		image = Image.createImage("/ice.jpeg");
	  }catch(Exception e){}

	  exit = new Command("Exit", Command.BACK, 1);
	  append(image);
	  this.addCommand(this.exit);
	  this.setCommandListener(this);
	}

	public void commandAction(Command c, Displayable d){
	  String label = c.getLabel();
	  if(label.equals("Exit")){
		midlet.notifyDestroyed();
	  }
	}
  }
} 

Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Location of Images in a compiled J2ME program

Posted 03 June 2009 - 10:46 AM

There is nothing wrong with your path. To verify the location of ice.jpeg, open the compiled .jar file in 7-Zip (or any other application that can read ZIP files) and search for the file.

The real reason why you can't use the image is because J2ME only supports the PNG format due to device constraints. Convert the image into PNG format and use it with Image and ImageItem classes.

EDIT: Topic Title edited to be more descriptive.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1