• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where do I put images in J2me application

 
carox kaur
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to J2me. I am facing problem with showing images in the List....
The directory structure/hierarchy of my project for such resources is:


<Main Project>-> resources-> base, customization1, customization2 folders.
Under Base, customization1, customization2 folders, each folder has Images, sounds folder.
In Base folder->Under images folder there are many folders each for screen size..I have put the image 'png' files in each of the folders including the image folder.
In customization1, customization2 folders->I have put the images in these folders including the image folder under these.

I think I have given some idea of the directory structure...if not, I ll make them more clear..
I want that images should appear after each items of the list....

The code is :


The error is that images are not appearing in each item of the list....
If something is not clear, kindly post.
 
Aleksandar Babic
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you have put lot of images under lot of folders
Maybe you should have only one folder with images for testing. Currently, if some of them are not shown, maybe the path is incorrect.
You can debug and see if images are created correctly.
 
Gopinath Karyadath
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a folder ( res) in your main project .
put all images in this folder.

add this folder in resource ..

you can create images .. like

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


Regrads

Gopinath - gopi@c2info.com

 
carox kaur
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a folder ( res) in your main project .
put all images in this folder.

add this folder in resource ..

I have created the folder res. Now how should I add this to resource?

What I have done till now is:
Created a directory structure
Main Project->resources->base, ScreenSize.128+x160+,ScreenSize.176+x220+,ScreenSize.240+x320+,ScreenSize.320+x240+
Now I have put the images in all these folders. base is the common folder and other are the screen size specific folders as mentioned in the documentation.

In build.xml I have done the following entry:

I am able to see the images in the mobile but the screensize specific images are not been used.
In java files, I have coded the same way as told by you. My program is able to access the images only from the base folder and not from the screen size specific folders. In all devices whatever be the screensize, the images are been picked only from the base folder. Do I need to code anything in build.xml?
 
Gopinath Karyadath
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select Resource from project window

right click on the resource > add folder ( res)

you can get the Image file in two ways , try this ..

image = Image.createImage("font16b.png") ;
image = Image.createImage(this.getClass().getResourceAsStream("/font16b.png")) ;




regards
gopinath
gopi@c2info.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic