Map in midlet

Hello
Currently we are writing a midlet and there's a requirement that the midlet should integrate a map. The map should work in offline mode, so yahoo map and google map is useless here. I should install the map with my app and draw it. I couldn't find any helpful information on the net. Anyone can give me a hint?
Thanks in advance :)

no one can help? :(

Similar Messages

  • Java.lang.ClassNotFound Exception whenever I include .send()

    Everything runs fine, but when I add the .send(message); [it is in bold] I get a java.lang.ClassNotFound Exception.
    It still compiles, it just won't allow me to launch the program in the emulator. If I take that one piece of code out, everything runs fine again. I've been messing with it, and searching for a long time in an attempt to solve the problem but I've yet to come across a solution.
    I'm also using Bluej
    import java.io.*;
    import java.lang.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;//Add SMS text, Map selection (upload image/altitude-scale)
    import javax.microedition.lcdui.Font;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.wireless.messaging.*;
       public class cardcanvas extends GameCanvas implements Runnable, CommandListener {
        Image i, Mortar, Target, paintballcharleston, selectimg, Cursor;
        SendSMS sendtext;
        Thread t = new Thread(this);
        Command cmdfire=new Command("Fire", Command.BACK, 1 );
        Command cmdreset=new Command("Reset", Command.ITEM, 2 );
        String text, message;
        static Image Map;
        MessageConnection messageConnection;
        TextMessage textMessage;
        int mortarX=5500, mortarY=5500, targetX=5500, targetY=5500, distanceX, distanceY, delay, mapx=-250, mapy=-250, xvel=115, yvel=130, gameAction=0, timer=0;
        double A, B, C, b, degreeX, degreeY, degreeV, voltageX, voltageY, scale=1.4235, findDegree=90;//get scale of pixel:realtime feet
        boolean paintdown=false, paintup=false, paintright=false, paintleft=false, left, finish, firemor, initiate, click, bottom=true, noYdegree, reset, sms=false;
        public cardcanvas(){
            super(false);
            this.addCommand(cmdfire);
            this.addCommand(cmdreset);
            this.setCommandListener(this);
        public void intit() {}
        public void start() {
            t.start() {}
        public void run()
            try{
                while(true)
                    if(paintright) {
                        timer++;
                        if(timer>1&&timer<4) xvel=xvel+5;
                        if(timer>=4&&timer<6) xvel=xvel+10;
                        if(timer>=6) xvel=xvel+20;
                    if(paintleft) {
                        timer++;
                        if(timer>1&&timer<4) xvel=xvel-5;
                        if(timer>=4&&timer<6) xvel=xvel-10;
                        if(timer>=6) xvel=xvel-20;
                    if(paintup) {
                        timer++;
                        if(timer>1&&timer<4) yvel=yvel-5;
                        if(timer>=4&&timer<6) yvel=yvel-10;
                        if(timer>=6) yvel=yvel-20;
                    if(paintdown) {
                        timer++;
                        if(timer>1&&timer<4) yvel=yvel+5;
                        if(timer>=4&&timer<6) yvel=yvel+10;
                        if(timer>=6) yvel=yvel+20;
                    if(mapy<-320) mapy=-320;
                    if(mapx>0) mapx=0;
                    if(mapy>0) mapy=0;
                    if(mapx>197) mapx=197;
                    if(xvel>225)
                        mapx=mapx-5;
                        targetX=targetX-5;
                        mortarX=mortarX-5;
                        xvel=225;
                    if(xvel<5)
                        mapx=mapx+5;
                        targetX=targetX+5;
                        mortarX=mortarX+5;
                        xvel=5;
                    if(yvel>260)
                        mapy=mapy-5;
                        targetY=targetY-5;
                        mortarY=mortarY-5;
                        yvel=260;
                    if(yvel<5)
                        mapy=mapy+5;
                        targetY=targetY+5;
                        mortarY=mortarY+5;
                        yvel=5;
                        if(reset) {
                            mapx=-250;
                            mapy=-250;
                            xvel=115;
                            yvel=130;
                            left=false;
                            firemor=false;
                            finish=false;
                            initiate=false;
                            click=false;
                            bottom=true;
                            noYdegree=false;
                            reset=false;
                            targetX=5500;
                            targetY=5500;
                            mortarX=5500;
                            mortarY=5500;
                            A=0;
                            B=0;
                            C=0;
                            b=0;
                            degreeX=0;
                        if(initiate) {
                           distanceX=targetX-mortarX;
                           distanceY=targetY-mortarY;
                           A=distanceY;
                           B=distanceX;
                               if(distanceY<0)
                                    A=distanceY*-1;
                                    bottom=false;
                               if(distanceX<0)
                                    B=distanceX*-1;
                                    left=true;
                            A=A*scale;
                            B=B*scale;
                            C=Math.sqrt((A*A)+(B*B));
                                while(((A*(Math.tan(b)))<B+.00002))
                                    b=b+.0001;
                            b=b*180/3.1415926535897932384626435;
                            degreeX=b;
                                if(bottom)
                                    b=90-b;
                                    b=b+90;
                                    degreeX=b;
                                if(left)
                                    degreeX=360-b;
                            initiate=false;
                            text=("DegreeX is "+degreeX+" Range is "+C);
                             sendTextMessage();
                     verifyGameState();
                     paint(getGraphics());
                     Thread.currentThread().sleep(1);
                catch (Exception E) {}
        private void verifyGameState() {}
        public void sendTextMessage()
            try
                String message = " ";
                MessageConnection messageConnection = (MessageConnection)Connector.open("sms://18433036060");
                TextMessage textMessage = (TextMessage)messageConnection.newMessage(
                        MessageConnection.TEXT_MESSAGE, "18433036060");
                textMessage.setPayloadText(message);
                *messageConnection.send(textMessage);*
            catch (Exception e) {}
    }If I remove messageConnection.send(texstMessage); the error is gone.
    Thanks in advance for your time

    cardmidlet:
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    import java.io.IOException;
    import java.lang.*;
    public class cardmidlet extends MIDlet implements CommandListener {
        private Display display; Display map;
        cardmidlet midlet;
        private Form form; Form mapselection;
        private List menuList ;
        String[] elements=new String[]{"Initiate Program","Select Map","Help","About"};
        private Command selectCommand;
        Alert alert;
            private Command fnext=new Command("NEXT",Command.ITEM,1);
            private Command fback=new Command("BACK",Command.BACK,1);
            private Command mapnext=new Command("Next",Command.ITEM,1);
        private TextField uname; TextField mapchoice;
        public String nname, nmap;
        cardcanvas cd;
        protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
        protected void pauseApp() {
        public cardmidlet() {
             menuList();
             cd = new cardcanvas();
        public void menuList(){
             display = Display.getDisplay(this);
             menuList = new List("Menu", List.IMPLICIT, elements, null);
             selectCommand=new Command("open",Command.ITEM,1);
             menuList.setSelectCommand(selectCommand);
             menuList.setCommandListener(this);  
        protected void startApp() throws MIDletStateChangeException {
            display.setCurrent(menuList);
        public void about(){
            alert = new Alert("Option Selected", "This program is created by"+"\n"+" Chris Furlong.", null, null);
              alert.setTimeout(Alert.FOREVER);
              alert.setType(AlertType.INFO);
              display.setCurrent(alert);
        public void help() {
            alert = new Alert("Option Selected", "Use the 4 d-pad keys to move the cursor. Press the center button once to select the mortar position, and a second time to select the target position. When both the mortar and the target are on screen, press the upper left key to begin the firing process. If you place one on the map by mistake, simply reset the program with the upper right key and start over.", null, null);
            alert.setTimeout(Alert.FOREVER);
            alert.setType(AlertType.INFO);
            display.setCurrent(alert);
        public void InitiateProgram(){
            display=Display.getDisplay(this);
            uname=new TextField("Enter your name","",50,TextField.ANY);
            form =new Form("New User");
            form.append(uname);
            form.addCommand(fnext);
            form.addCommand(fback);
            form.setCommandListener(this);
            display.setCurrent(form);
        public void selectmap()
           /* display=map.getDisplay(this);
            mapchoice=new TextField("Enter Map Name","",50,TextField.ANY);
            mapselection=new Form("Map Selection");
            mapselection.append(mapchoice);
            mapselection.addCommand(mapnext);
            mapselection.addCommand(fback);
            mapselection.setCommandListener(this);
            display.setCurrent(mapselection);*/
            display = map.getDisplay(this);
            map choose=new map();
        public String name(){
            nname=uname.getString();
            return nname;
    /*   public String mapname() {
            nmap=mapchoice.getString();
            return nmap;
        public void commandAction(Command com, Displayable arg1) {
             if(com==selectCommand)
                if(menuList.getSelectedIndex()==3)
                    about();
                if(menuList.getSelectedIndex()==2)
                    help();
                if(menuList.getSelectedIndex()==1)
                    selectmap();
                if(menuList.getSelectedIndex()==0)
                    InitiateProgram();
            if(com==fback)
                display.setCurrent(menuList);
            if(com==fnext){
                display = Display.getDisplay(this);
                cd.start();
                display.setCurrent(cd);
            if(com==mapnext)
                display = map.getDisplay(this);
                map choose=new map();
                display.setCurrent(choose);
    }

  • Problem executing midlet

    I launch a midlet with the j2me netbeans utility, but when I try to select (already in the mobile simulator), i get this error:
    Unable to create MIDlet ListDemo
    java.lang.ClassNotFoundException: ListDemo
            at com.sun.midp.midlet.MIDletState.createMIDlet(MIDletState.java:147)
            at com.sun.midp.midlet.Selector.run(Selector.java:151)I don't know if it is related to the code or if it is a common problem. I've tried searching on google and didn't get any feedback.
    Here's the code
    public class ListDemo
            extends MIDlet
            implements CommandListener {
        private final static Command CMD_EXIT =
                new Command("Exit", Command.EXIT, 1);
        private final static Command CMD_BACK =
                new Command("Back", Command.BACK, 1);
        private Display display;
        private List mainList;
        private List devList;
        private List roomList;
        private List specList;
        private boolean firstTime;
        public ListDemo() {
            display = Display.getDisplay(this);
            try{
                Hashtable deviceMap = getDeviceList();
                // this array defines the special actions
                String[] specArray = { "Dispositivos", "Habitaciones", "Modos" };
                // the string elements will have no images
                Image[] imageArray = null;
                devList = new List("Devices", Choice.EXCLUSIVE, fillDeviceList(deviceMap),
                        imageArray);
                devList.addCommand(CMD_BACK);
                devList.addCommand(CMD_EXIT);
                devList.setCommandListener(this);
                roomList = new List("Rooms", Choice.EXCLUSIVE, specArray,
                        imageArray);
                roomList.addCommand(CMD_BACK);
                roomList.addCommand(CMD_EXIT);
                roomList.setCommandListener(this);
                specList = new List("spec", Choice.MULTIPLE, specArray,
                        imageArray);
                specList.addCommand(CMD_BACK);
                specList.addCommand(CMD_EXIT);
                specList.setCommandListener(this);
                firstTime = true;
            }catch(IOException e){
                e.printStackTrace();
            }catch(XmlPullParserException xe){
                xe.printStackTrace();
         protected void startApp() {
              if (firstTime) {
                   // these are the images and strings for the choices.
                   Image[] imageArray = null;
                   try {
                        // load the duke image to place in the image array
                        Image icon = Image.createImage("/midp/uidemo/Icon.png");
                        // these are the images and strings for the choices.
                        imageArray = new Image[] {
                                  icon,
                                  icon,
                                  icon
                   } catch (java.io.IOException err) {
                        // ignore the image loading failure the application can recover.
                   String[] stringArray = {
                             "Dispositivos",
                             "Habitaciones",
                             "Especiales"
                   mainList = new List("Choose type", Choice.IMPLICIT, stringArray,
                             imageArray);
                   mainList.addCommand(CMD_EXIT);
                   mainList.setCommandListener(this);
                   display.setCurrent(mainList);
                   firstTime = false;
         protected void destroyApp(boolean unconditional) {
         protected void pauseApp() {
         public void commandAction(Command c, Displayable d) {
              if (d.equals(mainList)) {
                   // in the main list
                   if (c == List.SELECT_COMMAND) {
                        if (d.equals(mainList)) {
                             switch (((List)d).getSelectedIndex()) {
                             case 0:
                                  display.setCurrent(devList);
                                  break;
                             case 1:
                                  display.setCurrent(roomList);
                                  break;
                             case 2:
                                  display.setCurrent(specList);
                                  break;
              } else {
                   // in one of the sub-lists
                   if (c == CMD_BACK) {
                        display.setCurrent(mainList);
              if (c == CMD_EXIT) {
                   destroyApp(false);
                   notifyDestroyed();
         private String[] fillDeviceList(Hashtable map){
              Enumeration claves;
              String[] devices = new String[map.size()];
              claves = map.keys();
              for(int j=0;j<map.size();j++){
                   devices[j] = map.get(claves.nextElement()).toString();
              return null;
         private InputStream openUrl(String s) throws Exception {
              HttpConnection hc = (HttpConnection) Connector.open(s);
              return hc.openInputStream();
         private Hashtable getDeviceList() throws IOException,XmlPullParserException{
              DataInputStream dis = null;
              DataOutputStream dos = null;
              InputStream inputStream = null;
              Hashtable map = new Hashtable();
              try{
                   inputStream = openUrl("http://localhost:8084/WebApplication1/listDevices.do");
                   System.out.println("Despues de la conexi");
                   KXmlParser parser = new KXmlParser();
                   parser.setInput(new InputStreamReader(inputStream));
                   parser.nextTag();
                   parser.require(XmlPullParser.START_TAG, null, "devices");
                   System.out.println("devices...");
                   while(parser.nextTag() == XmlPullParser.START_TAG){
                        parser.require(XmlPullParser.START_TAG, null, "device");                    
                        String id = nextValue("device-id",parser);
                        String name = nextValue("name",parser);
                        String roomLocation = nextValue("room-location",parser);
                        String isAvaliable = nextValue("is-avaliable",parser);
                        String state = nextValue("state",parser);
                        map.put(id, name);
                        parser.nextTag();
                   parser.require(XmlPullParser.END_TAG,null,"devices");
                   parser.next();
                   parser.require(XmlPullParser.END_DOCUMENT,null,null);
              }catch(XmlPullParserException xe){
                   System.out.println("excepcion");
                   xe.printStackTrace();
              }catch(IOException e){
                   e.printStackTrace();
              }catch(Exception e){
                   e.printStackTrace();
              }finally{
                   try{
                        if (dis != null) dis.close();
                   }catch(IOException ignored){}
                   try{
                        if (dos != null) dos.close();
                   }catch(IOException ignored){}
                   return map;
    private String nextValue(String tagName, KXmlParser parser) throws XmlPullParserException, IOException {
         String string = null;
         parser.nextTag();
         parser.require(XmlPullParser.START_TAG, null, tagName);
         string = parser.nextText();
         parser.require(XmlPullParser.END_TAG, null, tagName);
         return string;
    }

    Hi,
    I had this problem in KToolbar which is the utility shipped with J2ME and what i had to do was make sure that KToolbar was looking for the main class to load, which in yours would be the ListDemo.class. i havn't used the netbeans utility but (if you can) make sure the main class is listed. (it might be in the project settings).
    Dex

  • Blackberry controls and midlets

    Midlet meets blackberry let the battle for who can use the escape key begin!
    If you're having trouble mapping keys from the blackberry to your midlet..this will definitely help you!
    in this post I go over: Adding menu items to the blackberry menu, and gaining access to undetected keys such as the Escape Key.
    First of all, that **** menu how do I add stuff to it?
    Well...that in itself is a hastle but lemme just say, that menu
    is in a nutshell a CommandListener. Same freakin menu. Later on in this post I show how to map the escape key..and i'm guessing pretty much every other key...of course
    the only key I ever had a problem with was the EscapeKey/HangUpKey
    Anyways if you want that BlackBerry Menu Code here
    * MIDletDemo.java
    * Copyright &copy; 1998-2008 Research In Motion Ltd.
    * Note: For the sake of simplicity, this sample application may not leverage
    * resource bundles and resource strings.  However, it is STRONGLY recommended
    * that application developers make use of the localization features available
    * within the BlackBerry development platform to ensure a seamless application
    * experience across a variety of languages and geographies.  For more information
    * on localizing your application, please refer to the BlackBerry Java Development
    * Environment Development Guide associated with this release.
    import java.util.*;
    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.lang.*;
    * An Example MIDlet.
    * The application must extend the MIDlet class to allow the application management
    * software to control the MIDlet.
    public class MIDletDemo extends MIDlet implements CommandListener
        private Alert _alert;
        private int _time;
        private Form _form;
        private myCanvas customCanvas;
        private Display _display;
        private UpdateThread _updateThread;
         * The thread that updates the explosion dialog box.
        private class UpdateThread extends Thread
            private boolean _disarmed;
            public void run()
                _disarmed = false;
                int i = _time;
                while (i > 0 && !_disarmed)
                    try
                        _alert.setString(Integer.toString(i));
                        synchronized(this)
                                this.wait(1000);
                        System.out.println("timeout in:" +i);
                    catch(InterruptedException e)
                        System.out.println("MyMidlet: Exception: " + e);
                    i--;
                if(!_disarmed)
                    _alert.setString("BOOM");
            void disarm()
                _disarmed = true;
         * Thread that pops up the program's main dialog box.
        private class GoCommand extends Command implements Runnable
            private GoCommand(String label, int type, int priority)
                super(label, type, priority);
            public void run()
                _alert.setString(Integer.toString(_time));
                _alert.setTimeout(_time * 1000 + 5000);
                _updateThread = new UpdateThread();
                _updateThread.start();
                _display.setCurrent(_alert, _form);
         * <p>The default constructor. Creates a simple screen and a command with an alert
         * dialog box which pops up when the command is selected.
        public MIDletDemo()
            _alert = new Alert("The Thermonuclear Device has been activated!\nTo disarm the device, dismiss this Alert.\nDevice will detonate in:");
            _alert.setCommandListener(this);
            _time = 10;
            // Create a simple screen.
            _form = new Form("Thermo-Nuclear Event");
          _form.append("Choose 'Go' from the menu.");
         customCanvas = new myCanvas();
            _display = Display.getDisplay(this);
            // Add our command.
            //_form.addCommand(new GoCommand("Go", Command.SCREEN, 1));
    customCanvas.addCommand(new GoCommand("Go", Command.SCREEN, 1));
    customCanvas.setCommandListener(this);
            //_form.setCommandListener(this);
            _display.setCurrent(customCanvas);
        //_display.setCurrent(_form);
        public void commandAction(Command c, Displayable s)
            if ( c instanceof Runnable )
                ((Runnable)c).run();
            if( c == Alert.DISMISS_COMMAND )
                _updateThread.disarm();
            _display.setCurrent(playerGUI);
         * <p>Signals the MIDlet that it has entered the Active state.
        public void startApp()
            // Not implemented.
         * <p>Signals the MIDlet to stop and enter the Pause state.
        public void pauseApp()
            // Not implemented.
         * <p>Signals the MIDlet to terminate and enter the Destroyed state.
         * @param unconditional When set to true, the MIDlet must cleanup and release all
         * resources. Otherwise, the MIDlet may throw a MIDletStateChangeException to
         * indicate it does not want to be destroyed at this time.
        public void destroyApp(boolean unconditional)
            // Not implemented.
    }now keep in mind, I took this from a nice little example MIDlet called DemoMidlet inside the BlackBerry JDE
    so it's not like they didn't make an effort. I mean I pretty much took it out of their examples located in
    C:\Program Files\Research In Motion\BlackBerry JDE 4.6.0\samples\com\rim\samples\device\midletdemo
    but lets face it...some of us like to use the Canvas Class...so showing us how to use it with a Form not exactly helpful.
    All I did was the same thing it's just I made a canvas, and implemented the CommandListener, then swapped their form for my canvas.
    It freaking worked like a charm. I mean I didn't really use that alert stuff...as it wasn't necessary, but it's a nice demo to learn from.
    Part 2: The Escape Key!
    The first and only problem I noticed when porting over to the blackberry was the lack of certain keys
    that I truly enjoy and need. I guess blackberry decided to just not implement them
    into the MIDlet canvas class?
    I mean they did a great job at figuring out how to map the entire qwerty keyboard, but when it comes to the Escape Key
    good luck!
    So after tearing my hair out I found a solution...which i'm guessing everyone else also found but i'm posting this
    cuz well..what if you're tearing your hair out right now...calm down take a deep breaths this is currently working on the BB 9000
    jde emulator.
    First of all I know this sucks but if you want to use that lovely escape key you're going to have to implement the BB KeyListener.
    I know WTF MAN!? "first i code the whole thing using keylistener/commandlistener now I gotta use some stupid BB KEYLISTENER!?...just who does blackberry think they are?"
    well heres the thing, I tore my hair out for like 12 hours straight trying to get around this...but after giving it a rest it's not such a big deal.
    Steps
    1) you have to grab the blackberry net_rim_api, and add it to your wireless toolkit.
    the path is:
    C:\Program Files\Research In Motion\BlackBerry JDE 4.6.0\lib\net_rim_api.jar
    what I did was copied the file and pasted it into
    C:\WTK2.5.1\lib\ext
    once you have that inside your ext folder in your project settings you can enable the external package, this way you can build
    using the RIM API.
    in case you wanta take a glance at that headache it's : http://www.blackberry.com/developers/docs/4.5.0api/index.html
    to enable it simply open up wtk, go to project/settings/External API's and check it off...take note that the wtk 2.5 generally comes with
    Nokia SNAP Mobile API so i'm guessing it's a normal thing to do with MIDlets. Also if you check off Bundle..that's not too good it includes the API
    with your package...which is really only helpful if you're trying to include some of that junk which really isn't necessary as the reason we're doing this in the first
    place is cuz blackberry wanted to be cool and have their own proprietary keys....
    Anyways check that off and continue to step 2.
    Implementing Key Listener with the Canvas Class! :-)
    2) This part is so easy...
    import java.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import net.rim.device.api.system.*;
    public class myCanvas extends Canvas implements CommandListener,KeyListener{
    String thekey = "no key pressed yet";
      public myCanvas() {
    Application.getApplication().addKeyListener(this);
    public void paint(Graphics g){
    g.setColor(255,255,255);
    g.fillRect(0,0,500,500);
    g.setColor(0,0,0);
    g.drawString(thekey,0,0,Graphics.TOP|Graphics.LEFT);
    public boolean keyDown(int keycode, int time)
                    thekey = String.valueOf(keycode);
                    repaint();
                return false;
            public boolean keyRepeat(int keycode, int time)
                 return false;
            public boolean keyStatus(int keycode, int time)
                  return false;
            public boolean keyUp(int keycode, int time)
                   return false;
      public boolean keyChar(char key, int status, int time) {
          if (key == Characters.ESCAPE)
             return false;
    public void commandAction(Command c, Displayable s)
      ///YOU DON'T NEED THIS! I just left it here, in case you wanted to also use the blackberry menu to do stuff...in this case
    //well the command is shown...and it calls the run method of the class you add the command to. My previous example
    // used the command GO, and i made a private class...so this would cause the run method to execute when the user hits enter on go.     
         // if ( c instanceof Runnable )
              //  ((Runnable)c).run();
    }i'm gonne be honest with you, the function public boolean keyChar()
    I don't know if that actually works...I just don't want to recompile without it cuz I just got over this headache..so I left it there.
    According to most people you use that to check if the key == Characters.ESCAPE and if it does then you do some stuff.
    Also you don't need the command listener, I just left it in there because well..if you're like me and you use the blackberry menu, you're pretty much
    going to use the CommandListener on your canvas to check to see if the user hit enter on a menu item.
    The function that matters here, is the same function Midlet coders are used to.
    instead of keyPressed it's simply keyDown
    so basically you're importing the package
    import net.rim.device.api.system.*;
    which allows you to implement blackberry's keyListener which gives you access to all the keys vs. a limited amount of them.
    now blackberry went all out as you can see. You have to have keyDown, keyUp, keyRepeated...it's kinda rediculous.
    but no worries, as long as you make sure that Display.setCurrent(yourcanvas);
    or you use one of those to give the canvas control...you'll be fine.
    It works because in the method for creating myCanvas()
    or whatever canvas you'll be using, it calls Application.getApplication.addKeyListener(this);
    and that little command gives your canvas the ability to listen for blackberry keys such as escape.
    the current code will start displaying the keycodes for each key...and apparently keys such as ESCAPE
    can be labeled properly. I love this because I can map the hang up call key to destroy my midlet, or even the escape key.
    Unfortunately every keycode displayed is in like unicode or some stupid format, so that's my guess as to why the Escape key is not detected by the normal
    canvas keyPressed method.
    Anyways you're done this should work...now if you're having trouble using canvas and you're like "but I don't use canvas" idk man...
    I use canvas...cuz I think programs should look cool. I'm sure this works without the canvas...on a form or something.
    But don't be fooled, you're not limited to KeyListener, you can also use TrackWheelEvent and all kinds of stuff. So just like the choices for CommandListener vs. keyPressed
    Blackberry has other choices as well.
    And they said merging the API's was a bad idea...shucks, how else are we supposed to use the freaking escape key.
    --JavaLover53
    P.S. I marked this as a question cuz I want people to really take a look at this. Make some comments, I love this forum
    and I really feel that this topic is not covered on the internet. A lot of naysayers, and when I found the solution I was like "that's it"
    "that's all I had to do?" "well then wheres the freaking tutorial!
    seriously people had me thinking I had to extend the blackberry UI when this is all I had to do..such an easy task
    that other people claim is ridiculously hard.
    Go ahead make your comments, lemme know if you know something I don't, i'm here to learn! :-)

    good writeup, however i found this only working when you're not running fullscreen

  • ALERT: java/lang/ClassFormatError: Bad stack map.

    Hello friends.
    I need help. SOS.
    Where is wrong in this code?
    Problem is in comparision.
    Comenting this lines, all are ok.
            if(time1==time2)
                System.out.println("Equal");
            else
                System.out.println("Different");C�digo del Midlet:
    package borrame.pruebas;
    import java.util.Date;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    public class Prueba extends MIDlet implements CommandListener {
        Display display;
        Form mainForm;
        // Comandos para salir y volver a la pantalla principal.
        Command cmdSalir;
        public Prueba() {
            super();
            mainForm = new Form ("HelloMidp");
            cmdSalir = new Command("Salir", Command.EXIT,1);
            mainForm.addCommand(cmdSalir);
            mainForm.setCommandListener(this);
        protected void startApp() throws MIDletStateChangeException {
            display = Display.getDisplay(this);
            display.setCurrent (mainForm);
            long time1 = new Date().getTime();
            long time2 = new Date().getTime() +100;
            System.out.println("time1: " + time1);
            System.out.println("time2: " + time2);
            System.out.println("time1 + time2 =" + (time1 + time2));
            if(time1==time2)
                System.out.println("Equal");
            else
                System.out.println("Different");
        protected void pauseApp() {
            // TODO Auto-generated method stub
        protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
            // TODO Auto-generated method stub
        public void commandAction(Command c, Displayable d) {
            if (c == cmdSalir) { // Selecciono salir de la aplicacion
                try {
                    destroyApp(false);
                } catch (MIDletStateChangeException e) {
                    e.printStackTrace();
                notifyDestroyed();
    }Output console:
    Warning: Cannot convert string "-b&h-lucida-medium-r-normal-sans-*-140-*-*-p-*-iso8859-1" to type FontStruct
    Running with storage root DefaultColorPhone
    ALERT: java/lang/ClassFormatError: Bad stack map.
    Method............: b7d29990 'com/sun/midp/midlet/MIDletState.createMIDlet (static)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d3a4
    Current IP........: b7da5669 = b7da565b + offset 14
    Previous Frame....: b783d36c
    Previous IP.......: b7d87f44 (offset 52)
    Frame size........: 7 (1 arguments, 6 local variables)
    Argument[0].......: b783cad0
    Local[1]..........: b78b35c8
    Local[2]..........: b7d87f41
    Local[3]..........: b783cc38
    Local[4]..........: b7d29788
    Local[5]..........: b78b355c
    Local[6]..........: 0
    Operand[1]........: b783cad0
    Method............: b7d16390 'com/sun/midp/midlet/Scheduler.schedule (virtual)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d36c
    Current IP........: b7d87f44 = b7d87f10 + offset 52
    Previous Frame....: b783d338
    Previous IP.......: b7d92b05 (offset 28)
    Frame size........: 7 (2 arguments, 5 local variables)
    Argument[0].......: b783cd14
    Argument[1].......: b783c460
    Local[2]..........: b78b20c4
    Local[3]..........: b78b3594
    Local[4]..........: b7d92b01
    Local[5]..........: b78b35a8
    Local[6]..........: b7d162b0
    Operand[1]........: b783cd14
    Method............: b7d1e084 'com/sun/midp/main/Main.runLocalClass (static)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d338
    Current IP........: b7d92b05 = b7d92ae9 + offset 28
    Previous Frame....: b783d314
    Previous IP.......: b7d9257c (offset 116)
    Frame size........: 3 (1 arguments, 2 local variables)
    Argument[0].......: b783d1bc
    Local[1]..........: b783c460
    Local[2]..........: b78b3570
    Method............: b7d1dfe4 'com/sun/midp/main/Main.main (static)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d314
    Current IP........: b7d9257c = b7d92508 + offset 116
    Previous Frame....: 0
    Previous IP.......: 1
    Frame size........: 3 (1 arguments, 2 local variables)
    Argument[0].......: b783d5ec
    Local[1]..........: b783d1bc
    Local[2]..........: b783cb24
    VM status:
    Instruction pointer.: b7da5669 (offset within invoking method: 14)
    Next instruction....: 0x4c
    Frame pointer.......: b783d3a4
    Local pointer.......: b783d388
    Stack size..........: 128; sp: b783d3bc; ranges: b783d308-b783d508;
    Contents of the current stack frame:
        b783d388: b783cad0 (lp)
        b783d38c: b78b35c8
        b783d390: b7d87f41
        b783d394: b783cc38
        b783d398: b7d29788
        b783d39c: b78b355c
        b783d3a0: 0
        b783d3a4: b783d36c (fp)
        b783d3a8: b7d87f44
        b783d3ac: b783d384
        b783d3b0: b7d29990
        b783d3b4: b783d300
        b783d3b8: 0 (end of frame)
        b783d3bc: b783cad0 (sp)
    Execution stack contains 184 items:
    b783d5ec
    b783d1bc
    b783cb24
    0
    1
    b78b3560
    b7d1dfe4
    b783d300
    0
    b783d1bc
    b783c460
    b78b3570
    b783d314
    b7d9257c
    b783d328
    b7d1e084
    b783d300
    0
    b783cd14
    b783c460
    b78b20c4
    b78b3594
    b7d92b01
    b78b35a8
    b7d162b0
    b783d338
    b7d92b05
    b783d34c
    b7d16390
    b783d300
    0
    b783cd14
    b783cad0
    b78b35c8
    b7d87f41
    b783cc38
    b7d29788
    b78b355c
    0
    b783d36c
    b7d87f44
    b783d384
    b7d29990
    b783d300
    0
    b783cad0
    Execution completed.
    717374 bytecodes executed
    5 thread switches
    742 classes in the system (including system classes)
    3720 dynamic objects allocated (102340 bytes)
    2 garbage collections (88196 bytes collected)
    Execution completed.
    717374 bytecodes executed
    5 thread switches
    742 classes in the system (including system classes)
    3720 dynamic objects allocated (102340 bytes)
    2 garbage collections (88196 bytes collected)

    My enviroment:
    Linux Gentoo.
    Sun JDK 1.4.2.10
    eclipse 3.2 WTP 1.5
    eclipseme 1.5.5
    Midlet config:
    MIDlet-Version: 1.0
    MicroEdition-Configuration: CLDC-1.0
    MicroEdition-Profile: MIDP-1.0
    WTK 2.2
    In last test, i'm using ktoolbar directly to build and execute midlet and all go ok.
    So, My code is not problem.
    I suppose that eclipseme corrupt my classes in build process.
    SOLUTION:
    My radical solution. I use eclipse without eclipseme, and i use ktoolbar to build, run, package, etc...
    Thank's

  • No Midlet Suites Found. Check the URL to make sure it is correct

    hi,
    i am very much in need of solution so plz respond as early as possible
    i am trying to simulate OTA provisioning through J2ME Wireless Toolkit for this i am using Apache HTTP Server Version 1.3
    i placed the .jad files and .jar files in htdocs directory and i added the below two lines to httpd.config file
    AddType text/vnd.sun.j2me.app-descriptor .jad
    AddType application/java-archive .jar
    i changed the MIDlet-Jar-URL property in .jad file to point to .jar file
    i restarted the Apache server and started the toolkit when i pointed to the .jad the error i got is "No Midlet Suites Found. Check the URL to make sure it is correct"
    can any one help me out in finding what i missed in the process of installing the midlet suite through OTA provisioning in the toolkit

    try adding these lines in the configuration file as applicable to your server
    <mime-mapping>
    <extension>jar</extension>
    <mime-type>application/java-archive</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jad</extension>
    <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
    </mime-mapping>
    Also, check if your JAD file contains the following information
    MIDlet-Jar-URL: http://<server_ip_or_name>:<port_if_other_than_80>/<context_root>/<name_of_your_file.jar>

  • Mobile maps

    Hi! I need help for a school project. The idea of the project is that users can upload a map (an image), supply the necessary information (to be stored in a database), so that other users can download the map and view it on their mobile phones. Example, the users can select which map to download and run on their phones.
    I was wondering if you have any ideas/suggestions on how best to do this project.
    Many thanks in advance...

    The desktop should only allow map editors to upload a map and supply map information. I was wondering if it's possible for the desktop application (made from regular java) to generate a midlet (made from Java ME?) so that the generated jar/jad file could be run on mobile phones.
    What I'm trying to do is like this project: http://www.cs.kent.ac.uk/pubs/ug/2005/co600/mobimap/Technical%20Report.pdf
    except that users can choose which map to run on their phones from maps that other users uploaded on the desktop.

  • Mobile maps help needed!

    I'm trying to design and develop an application which uses Location Based Services and basicaly shows an interactive map of the current location.
    I would like to ask if anyone knows where to start, I know more or less how to use JSR-179. Let's say I have current coordinates and then I want to display the map, the point is I would like to know which way to go from here.
    The Google Maps API is fairly easy if you use Java Script and a web browser, does anyone know how to get the map from google or maybe yahoo and display it in the midlet without the browser?
    There is a midlet available straight from google (mobile goolge maps http://www.google.com/gmm ) which is just great, I have no idea how it is implemented, If anyone knows, please send me some suggestions.
    I would like to accompish all the processing of the retrived images(possible from the google maps server) with Java EE and then retrive them and display them on the mobile (maybe as an XML file - SVGt image). Anyway, I hope I have described the idea, as I said I don't know where to go, and if there is someone with some experience with that kind of staff please help, this is my final year project and I'm not asking for the solution, just for some directions and the proper way of implementing those things.
    Thanks a lot in advance!

    You can use the Yahoo Maps API. It has a REST interface.
    http://developer.yahoo.com/maps/rest/V1/mapImage.html
    You can parse response and download the image.
    Alternatively you can use a server as an intermediary. For example, you can send your server the coords and options, then your server would talk to Google or Yahoo and retrieve the map image.
    I created an example app some time ago that will use the Yahoo Maps image. The project page is http://gallery.yahoo.com/apps/10685 and the source code is available on http://hostj2me.com/appdetails.html?id=2875
    It takes up to minute to initialize and retrieve the initial coords. But here is how it works.
    1) get GPS coods
    2) send cords (http get) to Yahoo
    3) parse XML response and retrieve image URL
    4) download and display image from URL

  • Anyone using openstreetmap and mapviewer/mapbuilder to create maps

    anyone using openstreetmap and mapviewer/mapbuilder to create maps?

    Ok, I do exactly as you specify here. In addition I import the needed jars from the import folder of j2mepolish. Also, I put the resources folder from the polish sample (MenuMidlet) in the project, and all marked errors disappears.
    Then I try to run it as an Ant build, and get the following error:
    BUILD FAILED
    D:\Program Files\eclipse31\j2me\sample\build.xml:115: The MIDlet [source.src.de.enough.polish.example.MenuMidlet] could not be found. Check your <midlet>-setting in the file [build.xml] or adjust the [sourceDir] attribute of the <build>-element.The MIDlet should be in D:\Program Files\eclipse31\j2me\sample\source\src\source\src\de\enough\polish\example\MenuMidlet.java
    Ok - so it seems that it for some reason gets "source\src" two times. So I go back to the <midlet class and remove the source.src, leaving just de.enough.polish.example.
    Then I run as Ant again, and it compiles successfully.
    However, when I try to run the MenuMidlet class as a j2me midlet (in eclipse) it starts, and then crash with this error:
    java.lang.NoClassDefFoundError: de/enough/polish/util/Locale
         at source.src.de.enough.polish.example.MenuMidlet.<init>(+11)
         at java.lang.Class.runCustomCode(+0)
         at com.sun.midp.midlet.MIDletState.createMIDlet(+19)
         at com.sun.midp.midlet.Scheduler.schedule(+52)
         at com.sun.midp.main.Main.runLocalClass(+28)
         at com.sun.midp.main.Main.main(+116)
    So - seemingly - to compile it I need to give it one address, but for the midlet to run it must be compiled with an address that won't let it compile :-)
    Well - then I create a J2ME package from the project, and run the deployed/sample.jad file. Then the midlet actually starts, but when I click Launch, the display shows:
    New Midlet de.enough.polish.ui.MenuBar Exception: java.lang.classNotFoundException: de/enough/polish/ui/MenuBar
    I can't find a reference to MenuBar anywhere in the sample code.

  • Is signing Compulsory for midlets?

    hai
    I am new to j2me i develop a network application its works fine in emulator nokia 6230i ,but when i install the same application in nokia 6230i , the application starts fine , and canvas screens are appear i am not getting any error ,but the data from the server is not came. i am not sign the midlet , any one plese tell me what i have to do (settings) before install
    thanks & regards
    Ravi varma

    XI is a middleware from SAP that is needed to connect to other SAP systems like SAP R/3 or non SAP systems.
    Now for SAP Auto ID Infrastructure scenarios where integartion is to happen to the SAP R/3, the config guides by SAP has taken XI as the middleware.
    However, XI is not at all compulsory to integrate to R/3. Any other middleware that can map from AII to R/3 or other systems can be used with AII.
    But if you are looking to configure the standard flexible delivery scenario from AII then its better to work with XI as SAP clearly details the steps needed to configure the solution in their configuration guides.
    Regards,
    Ashish

  • Remote System and Remote Key Mapping at a glance

    Hi,
    I want to discuss the concept of Remote System and Remote Key Mapping.
    Remote System is a logical system which is defined in MDM Console for a MDM Repository.
    We can define key mapping enabled at each table level.
    The key mapping is used to distinguish records at Data Manager after running the Data Import.
    Now 1 record can have 1 remote system with two different keys but two different records cannot have same remote system with same remote key. So, Remote key is an unique identifier for record for any remote system for each individual records.
    Now whenever we import data from a Remote System, the remote system and remote key are mapped for each individual records. Usually all records have different remote keys.
    Now, when syndicating back the record with default remote key is updated in the remote system that is sent by xml file format.
    If same record is updated two times from a same remote system, the remote key will be different and the record which is latest contains highest remote key.
    Now, I have to look at Data Syndication and Remote key.
    I have not done Data Syndication but my concept tell if there is duplicate record with same remote system but different remote keys both will be syndicated back. But if same record have two remote keys for same remote system then only the default remote key is syndicated back.
    Regards
    Kaushik Banerjee

    You are right Kaushik,
    I have not done Data Syndication but my concept tell if there is duplicate record with same remote system but different remote keys both will be syndicated back.
    Yes, but if they are duplicate, they needs to be merged.
    But if same record have two remote keys for same remote system then only the default remote key is syndicated back.
    This is after merging. So whichever remote key has tick mark in key mapping option(default) , it will be syndicated back.
    Pls refer to these links for better understanding.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/80eb6ea5-2a2f-2b10-f68e-bf735a45705f
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/7051c376-f939-2b10-7da1-c4f8f9eecc8c%0c
    Hope this helps,
    + An

  • Error while deleting a mapping

    Hi all,
    I am getting the following error while deleting a mapping. My client version is 10.2.0.4.36
    API5072: Internal Error: Null message for exception. Please contact Oracle Support with the stack trace and details on how to reproduce it.
    oracle.wh.util.Assert: API5072: Internal Error: Null message for exception. Please contact Oracle Support with the stack trace and details on how to reproduce it.
         at oracle.wh.util.Assert.owbAssert(Assert.java:51)
         at oracle.wh.ui.jcommon.OutputConfigure.showMsg(OutputConfigure.java:216)
         at oracle.wh.ui.common.CommonUtils.error(CommonUtils.java:370)
         at oracle.wh.ui.common.WhDeletion.doActualDel(WhDeletion.java:512)
         at oracle.wh.ui.common.WhDeletion.deleteObject(WhDeletion.java:203)
         at oracle.wh.ui.common.WhDeletion.deleteObject(WhDeletion.java:283)
         at oracle.wh.ui.jcommon.tree.WhTree.deleteItem(WhTree.java:346)
         at oracle.wh.ui.console.commands.DeleteCmd.performAction(DeleteCmd.java:50)
         at oracle.wh.ui.console.commands.TreeMenuHandler$1.run(TreeMenuHandler.java:188)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:189)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:478)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Thanks in advance!
    Sebastian

    These type of Internal Errors are all too common in OWB and it's difficult to diagnose the exact problem.
    I'd suggest closing the Design Centre, going back in and trying to delete it again, this will often resolve Internal errors.
    There's also an article on Metalink Doc ID: 460411.1 about errors when deleting mappings but it's specific to an ACLContainer error, so may or may not be of use.
    One of the suggestions is to connect as the Repository Owner rather than a User and try to delete the mapping.
    Cheers
    Si
    Edited by: ScoobySi on Sep 10, 2009 11:44 AM

  • FileName in ABAP XSLT Mapping

    Dear SDN,
    In an integration scenario we are using sender File Adapter and a  ABAP XSLT Mapping.
    Is there any way to get the source FileName from such mapping.  Im trying to use the adapter-specific message attributes, but it doesn't work, and I didn´t find an example, probably I and doing somthing wrong.
    regards,
    GP

    Thank you for your help,
    I just try to access the adapter-specific attibutes using:
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
    <xsl:variable name="filename"  select="key:create('http://sap.com/xi/XI/System/File', 'Directory')" />
    </xsl:stylesheet>
    but the following error raised:
    <SAP:Stack>Error while calling mapping program YXSLT_TEST (type Abap-XSLT, kernel error ID CX_XSLT_RUNTIME_ERROR) Call of unknown function</SAP:Stack>
    have you had this situation?

  • Sample source code for fields mapping in expert routine

    Hi All
    Iam writing the expert routine from dso to cube for example I have two fields in dso FLD1,FLD2
    same fields in infocube also ,can any body provide me sample abap code to map source fields to target fields in expert routine,your help will be heighly appreciatble,it's an argent.
    regards
    eliaz

    Basic would be ;
    RESULT_FIELDS -xxx = <SOURCE_FIELDS> -xxx
    you have the source fields as source, and result fields for as the target. In between you can check some conditions as in other routines of transformation.
    BEGIN OF tys_SC_1, shows your source fields ( in your case DSO chars and key figures)
    BEGIN OF tys_TG_1, , shows your result fields ( in your case Cube characteristics)
    Hope this helps
    Derya

  • How can I distinguish different action mapping in one ActionClass file?

    I would like to create a ActionClass which will handle 3 mapping which comes from /add, /show or /del.
    My question is how can I change the code so that the ActionClass servlet can distinguish the request from different url mapping ? Can anyone give me some short hints? Thx.
    struts-config.xml
    <action-mappings>
    <action name="MemberInfoForm" path="/add" scope="request" type="com.myapp.real.MemberAction">
    <action name="MemberInfoForm" path="/show" scope="request" type="com.myapp.real.MemberAction">
    <action name="MemberInfoForm" path="/del" scope="request" type="com.myapp.real.MemberAction">
    </action-mappings>MemberAction.class
    public class MemberAction extends org.apache.struts.action.Action {
        private final static String SUCCESS = "success";
        public ActionForward execute(ActionMapping mapping, ActionForm  form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
            return mapping.findForward(SUCCESS);
    ...

    http://struts.apache.org/1.2.x/api/org/apache/struts/actions/MappingDispatchAction.html
    http://struts.apache.org/1.2.x/api/org/apache/struts/actions/DispatchAction.html
    Thank you so much for all of your suggestion.
    I read the document of MappingDispatchAction and its note say:
    NOTE - Unlike DispatchAction, mapping characteristics may differ between the various handlers, so you can combine actions in the same class that, for example, differ in their use of forms or validation.........
    I wonder in DispatchAction, we can also have various forms or validation as MappingDispatchAction does, just by using different name in the action tag, for example:
    <action input="/p1.jsp" name="MForm1" path="/member" scope="session" parameter="action" type="com.myapp.real.MemberAction">
    <action input="/p2.jsp" name="MForm2" path="/member" scope="session" parameter="action" type="com.myapp.real.MemberAction">
    <action input="/p3.jsp" name="MForm3" path="/member" scope="session" parameter="action" type="com.myapp.real.MemberAction">Hence, it is not the difference as stated from the NOTE, right?
    Edited by: roamer on Jan 22, 2008 10:32 AM

Maybe you are looking for

  • Can I send a outside file as an attachment in SAP

    Hi Pals I have a requirement like, I have to print a script and I need to send that converting into PDF and send mail to the customer, at the same time I need to send the one more file which contains bank details, which will be stored on presentation

  • How to print out the text for Info record in ME23?

    Dear all, I need to print out a report of PO data. need to print out the text from Info record note (like the picture shown below) in ME23, how should I pull that field and display out? I need the solution urgently. Hope experts can help. Thank you v

  • Freeze during column view in finder and open file box?

    Whenever I open a file and the open file dialog box is in column view it freezes when I click on the file and the view shifts to reveal the icon and info. It happens a lot in finder too, but not as often. It usually doesn't start happening for a few

  • Why was my GoDaddy SSL Cert "Not from a Recognized Authority"

    I've seen many reports here of people experiencing problems installing and renewing SS Certificates in OS X Server. In my case a simple Certificate renewal turned into a Very Worrying Episode as the new certificate was "Not from a recognised authorit

  • 10.4.11 neinstallation fails

    Hi, I am creating an netinstall image of Intel 10.4.11 from iMac machine. After creating an NBI folder using SIU, I copied libbz2.1.0.3.dylib to Image /usr/lib of image. (As this is a know problem) This process used to work like champ before 6 months