The Images should be in the resources folder(res).not in Classes folder; That may be the problem.
And about EXIT:
A command used for exiting from the application. When the user invokes this command, the implementation does not exit automatically. The application's commandAction will be called, and it should exit the application if it is appropriate to do so.
Value 7 is assigned to EXIT.(plz check the API docs)
There are a set of key codes for all keys like in series 40 LSK = -6,RSK =-7 and so on.....
It all depends on how you are building your applications. Most SDKs (like the WTK, NDS, many IDEs) have a "press a button for a complete build"-type option. Each of these build environments has a different way of packaging the application. The WTK just takes whatever is in the res folder and puts it in the root of the jar. Other environments might take files from other directories. You can set up your own build environment (using the command line, batch files, Ant, etc.) and do it in a way that is specific to you. Putting resources in the classes directory will usually work because this directory has to be included (or else you won't have much of an application), so it usually works. But some build scripts do a clean build by erasing the classes directory before compilation (oops, there go your resources!).
So basically, the answer to the whole "where to put the images" dilemma is "it depends".
A good idea is to get familiar with Ant (and the J2ME specific tasks in Antenna), so that you can easily set up a build script exactly how you want it. It might take a few hours to get acquainted with the system, but the result is that you have complete control over your builds so you know exactly what is happening and what files are going into your jars (you can even set it up so that by changing a property you can make builds that take resources from different places to create specific builds for specific phones).
In the end you can always use any old zip utility to open up your jar and see exactly what files are in there and with what path they are stored.
InputStream inputStream = getClass().getResourceAsStream("incredi2-thumb.jpg");
byte image = new byte[inputStream.available()];
Image image1 = DirectUtils.createImage(image,0,image.length);
Hope it helps;-)
BTW - Do you know how to open a image so that the default option of open,save,delete,rename options(nokia 3120, or I guess avaiable in others as well as they are basic) are visible and subsequently trapped. if at all it is possible using j2me?
Originally posted by davewit13 hi,
Im new to J2ME and the forums, doing a college project having alot of difficulties.
I have this command listener line:
private Command exitCommand = new Command("Exit", Command.EXIT, 99);
But what does the "99" refer to.
The game is for a phone but how do you map the keys on a keypad (the specific phone is the Nokia 3510i, its a series 40).
I`m having awful trouble with images i have this code but it doesn`t work: