Exit Command doesn't work

Guys, I've put a few hours researching the web for code examples on how to program the Exit button on a J2ME app. It didn't help me finding out why my Exit simply doesn't work. It must be something trivial that I'm just not aware of. I would really appreciate your help analyzing the following code.
Regards,
Filipe
public class BiblioMIDlet extends MIDlet implements CommandListener {
     private Display display;
     private Form gui;
     private static Command renewCommand, exitCommand;
     public BiblioMIDlet() {
          renewCommand = new Command("Renew", Command.ITEM, 1);
          exitCommand = new Command("Exit", Command.EXIT, 1);
          gui = new Form("Biblio");
          display = Display.getDisplay(this);
     protected void startApp() throws MIDletStateChangeException {
          this.showLoginForm();
     private void showLoginForm() {
          TextField user = new TextField("User", null, 9, TextField.NUMERIC);
          TextField password = new TextField("Password", null, 4, TextField.PASSWORD | TextField.NUMERIC);
          gui.append(user);
          gui.append(password);
          gui.addCommand(renewCommand);
          gui.addCommand(exitCommand);
          display.setCurrent(gui);
     protected void pauseApp() {     }
     public void commandAction(Command c, Displayable s) {
          if (c == exitCommand) {
               destroyApp(false);
               notifyDestroyed();
     protected void destroyApp(boolean arg0) {      }
}

Hai
I think u missed to add the commandListener in your code "gui.setCommandListener(this)"
public class BiblioMIDlet extends MIDlet implements CommandListener {
     private Display display;
     private Form gui;
     Command renewCommand, exitCommand;
     public BiblioMIDlet() {
          renewCommand = new Command("Renew", Command.ITEM, 1);
          exitCommand = new Command("Exit", Command.EXIT, 1);
          gui = new Form("Biblio");
          display = Display.getDisplay(this);
     protected void startApp() throws MIDletStateChangeException {
          this.showLoginForm();
     private void showLoginForm() {
          TextField user = new TextField("User", null, 9, TextField.NUMERIC);
          TextField password = new TextField("Password", null, 4, TextField.PASSWORD | TextField.NUMERIC);
          gui.append(user);
          gui.append(password);
          gui.addCommand(renewCommand);
          gui.addCommand(exitCommand);
/* u missed this line of code in your program*/
          gui.setCommandListener(this);
/* End */
          display.setCurrent(gui);
     protected void pauseApp() {     }
     public void commandAction(Command c, Displayable s) {
          if (c == exitCommand) {
               destroyApp(false);
{ notifyDestroyed();
     protected void destroyApp(boolean arg0)      }
regards
jinesh

Similar Messages

  • AT EXIT-COMMAND doesn't work

    Hi experts,
    In screen painter I use AT EXIT-COMMAND to exit current screen as the following code. But it doesn't exit the screen if ok_code = 'create' while other ok_code work well. Can anyone tell me that's why?
    Thanks!
    module exit.
      if SY-UCOMM = 'EXIT' or SY-UCOMM = 'BACK'.
        LEAVE PROGRAM.
      elseif SY-UCOMM = 'CLEAR' or SY-UCOMM = 'CREATE'.
        CALL SCREEN 100.
    endmodule.

    write this statement  in PAI
    and check weather sy-ucomm capturing the key r not
    MODULE EXIT.
      IF sy-ucomm = 'LEAV'
        SET SCREEN 0.
        LEAVE SCREEN.
      ENDIF.
    ENDMODULE.
    Regards
    Anbu B

  • Visually handicap, needs to increase font size in logic pro, Command  doesn't work

    Hi,
         I'm visually handicapped, and new to logic-pro.  I'm having a miserable time reading the internal logic-pro fonts.  Command + doesn't work, and I can't find any preferrence or settings options that affect the default font sizes, any ideas?

    Unfortunately you cannot change the font size of the main fonts in Logic...
    However, there are a couple of other settings you may not be aware of...
    1) Under Logic Pro's preferences... go to Display
    Now you can change the size of the playhead and Local Windows under the General Tab
    You can increase the size of the Logic plugin windows/fonts sizes under the Mixer Tab (I have mine set to 200%)
    Note: This setting does not apply to 3rd party plugins.. only Logic's own plugins...
    Under the Piano Roll tab you can change the size of Bar/Beats/Division Lines...
    2) Using the screen zoom command... Hold down control and scroll on your mouse... will zoom in the screen...
    Note: as you are using Mountain Lion there is also a new setting under System Preferences/Accessability
    Choose Zoom on the left hand side
    Now choose Zoom Style/Picture in Picture and instead of a full screen zoom it provides you with a magnifying glass of sorts to just magnify the area arund your mouse pointer. I find this setting very useful....
    Hope this helps...

  • HT1338 Safari Hide command doesn't work

    Now my Safari 6.0 "Hide Safari" command doesn't work (whether clicking the command-H or going up under the Safari menu and down to the Hide Safari command.
    Any suggestions anyone? I am about one more issue away from abandoning Safari altogether and just using Chrome and Firefox.

    I've made a number of iWeb websites. I notice that I can't "Command +" the text larger or smaller. Is this a function of an iWeb site .. or is there something I'm missing?
    What browser are you talking about? If Safari, is it the same with the other major browsers (Firefox and Opera)? Could you provide the url of an example?

  • Bash command doesn't work after update

    I just ran pacman -Syu as normal, but some got many errors like below:
    ( 3/11) upgrading binutils
    error: command failed to execute correctly
    and every package except kernel-headers got a error message like that. and then i found most of my bash command doesn't work any more, just like ls and vim. However, some others like pwd and cd still work correctly.
    Any one any ideal?
    Last edited by ranjiao (2009-11-12 13:26:01)

    ranjiao wrote:I removed /lib64 and make a soft link from /lib64 to /lib, as Matlab09 requires a /lib64 containing crt libs.
    is this the cause?
    Yes.
    I've done that before and got into the same problem when updating glibc, the lesson here, don't mess with the default directory structure.

  • Windows exit button doesn't work

    Hi,
    Does anybody know why the windows' red exit button doesn't work for my program?
    Thanks

    Hamed_47 wrote:
    The close button is set to be in the menu, so I it's not in tle list of this close control.
    Sorry, I did not understand what you mean.
    The ring control lists all the controls you have on the panel, and usually there is a QUIT ot EXIT button. You may want to select this one.
    What this ring control does is equivalent to setting the ATTR_CLOSE_CTRL programmatically, i.e. you define the ID of the control for which a commit event is generated when you select the Close item in the Windows system menu.

  • Unhide library command doesn't work

    Unhide library command doesn't work in terminal

    Open the Terminal application in your Utilities and paste the following at the prompt:
    sudo chflags nohidden ~/Library
    Press RETURN. Enter your admin password when prompted. It will not be echoed.
    The "sudo" may not even be required, but if it is and you don't use it, then you'll get an error message. Just try again using the above command.

  • Exit Customize doesn't work - other questions...

    Firefox updated to Beta 29 (i didn't do it x_x) and everything is confusing me right now. Actually pissing me off to be honest. I was playing around this new, tried to customize it but didn't work. I followed this page and nothing. https://support.mozilla.org/en-US/kb/customize-firefox-controls-buttons-and-toolbars the Exit Customize doesn't work at all. I have to quit firefox using Alt+F4 and start all over.
    So, that doesn't work for me. How do I go back to the previous version of Firefox or how do I undo this Beta 29 thing? I really don't like it.

    You can check for problems with preferences.
    Delete a possible user.js file and numbered prefs-##.js files and rename (or delete) the prefs.js file to reset all prefs to the default value including prefs set via user.js and prefs that are no longer supported in the current Firefox release.
    *http://kb.mozillazine.org/Preferences_not_saved
    *http://kb.mozillazine.org/Resetting_preferences
    You can check for problems caused by a corrupted localstore.rdf file.
    *http://kb.mozillazine.org/Corrupt_localstore.rdf
    Create a new profile as a test to check if your current profile is causing the problem.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    If the new profile works then you can transfer files from a previously used profile to the new profile, but be cautious not to copy corrupted files to avoid carrying over the problem
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Safari 6.0 command- doesn't work

    Command+ works fine but command- doesn't work. I'm running 10.7.5

    Just add the following to the file com.apple.WebProcess.sb.
    Please add it below the Basic system paths and above the FIXME: or System and user preferences:
    ;; Plugins
    (subpath "/Library/Internet Plug-Ins")
    (home-subpath "/Library/Internet Plug-Ins")
    And it's fixed!

  • I have a few desktop icons that won't allow me to move them to trash or relocate them on desktop.  A PDF, a DOCX and a PART.  Not locked under get info or get info command doesn't work. Suggestions?

    I have a few desktop icons that won't allow me to move them to trash or relocate them on desktop.  A PDF, a DOCX and a PART.  Not locked under get info or get info command doesn't work. Suggestions?

    This any help?
    http://support.apple.com/kb/HT1526

  • Exit screen doesn't work

    Hi everyone,
    In screen painter there is the code:
        WHEN 'EXIT'.
          LEAVE PROGRAM.
    But it doesn't exit the current screen. What's the problem? (leave screen doesn't work either.)
    Thanks!

    Hi,
    use this.
    Process After Input.
    Module exit AT EXIT-COMMAND.
    in program.
    Case Okcode.
    When 'Exit'.
    leave to screen 0.
    Automatic field checks can be avoided by AT EXIT-COMMAND, Which works exactly the same way as cancel works on application tols bar.
    EXIT button on the toolbar has FUNCTION TYPE 'E' only function type's can enter a module with addition AT EXIT-COMMAND

  • [SOLVED] openbox menu command doesn't work with &&

    I'm now using openbox-session only.
    I'd like to run a program after something was done correctly:
    zenity --question && killall openbox
    I used "obmenu" and it seems that it fixes & to & correctly in the menu.xml.
    However, the previous command "zenity" is run only.
    In terminal, there's no problem, but it doesn't work with "command" in openbox menu.
    <item label="Exit">
    <action name="Execute">
    <execute>
    zenity --question --title="Exit" --text="Are you sure to go back to console?" && killall openbox
    </execute>
    </action>
    </item>
    Please, give me any idea. Thank you.
    Last edited by mairoo (2009-09-09 10:06:17)

    hbekel wrote:
    You'll need to use a shell explicitly:
    <execute>
    sh -c 'command1 && command2'
    </execute>
    I flagged "solved" thanks to your help. It works good. Thank you.

  • Unix Command doesn't work in Tiger

    Hi,
    I've got labs of eMacs that I'm finally upgrading to Tiger. My image seems to work fine, but I'm running into a weird quirk with my "Send Unix" commands via ARD. We're doing NWEA testing and LOVE the unix commands because we can login to machines, turn on TestTaker, login to TestTaker, and select the correct test (math or reading) and the right version of the test.
    The script below works fine on a panther eMac.
    osascript
    tell application "System Events"
    keystroke "1" using command down
    delay 3.0
    keystroke ASCII character 31
    delay 2.0
    keystroke return
    keystroke "n" using command down
    end tell
    On my Tiger machines, the command stops on the:
    "Keystroke ASCII character 31" line (this should arrow down to next test version).
    A report window comes up in ARD with this error message:
    86:104: execution error: System Events got an error: 31 doesn't understand the ASCII character message. (-1708)
    This used to work perfectly, but now I can't get ASCII 31 (or arrow down to work). The real killer is that other techs in my school district have eMacs running tiger with same commands that work (some have to arrow down 16 times to get to correct test version). The other commands (like command 1 and returns, command n) all work fine! Hate to have to touch 80 machines each day to select proper test version when we log in.
    Any Suggestions????

    Try this form of the line:
    keystroke (ASCII character of 31)
    That's worked for some people. Hope it works for you. If it doesn't work as given, try without the parentheses.
    Regards.

  • USER Exit variable doesn't work in BSP

    Hi gurus
    I made a characteristic variable with user-exit replacement type.
    It get the user id from sy-uname. It works well in Gui version. But when I execute the layout in BSP (WI), it doesn't work.
    But If i do the hard-coding the line from (l_eto_charsel-low   = uid.) to (l_eto_charsel-low   = '4012121'.) it works well.
    The following is my coding.
    Please give me any comment.
      CLEAR eto_charsel.
      DATA l_eto_charsel TYPE upc_ys_charsel.
      DATA  uid type c. "(also I have tried 'data uid type sy-uname')
      uid = sy-uname.
      l_eto_charsel-chanm = i_chanm.
      l_eto_charsel-seqno = '0001'.
      l_eto_charsel-sign  = 'I'.
      l_eto_charsel-opt   = 'EQ'.
      l_eto_charsel-low   = uid.  ++++>
      INSERT l_eto_charsel INTO TABLE eto_charsel.
    ENDFUNCTION.
    Message was edited by: Bryan Lee

    Hi,
    Your patch level seems to be OK.
    pls. try the declaration as 'Data: uid like syst-uname' or you could try directly assigning the sy-uname.
    Try to debug and see the content of the sy-uname, when it hits this code.
    HTH,
    Regards,
    Nataraj.

  • Currency conversion type by customer exit variable doesn't work

    Hi all.
    In my query I need amounts by quarter, applying quarters last date rates as currency conversion.
    Query has Year parameter. Based on this parameter, by customer exits I calculate every quarters last date and use them as currency conversion types.
    The problem is that query DOESN'T APPLY currency conversions!
    I checked TCURR table - currency conversions do exist for applied days
    I checked my customer exits - the date calculation works fine
    I suppose where is something wrong in query processes (customer exits/currency conversions) sequence before running it.
    Someone knows anything 'bout that?

    Check these docs.. and check again.
    [Creating Currency Translation Types|http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6813e07211d2acb80000e829fbfe/content.htm]
    [Use Variables for Currency Conversion|http://www.scribd.com/doc/7061035/How-to-Use-Variables-for-Currency-Conversion]

Maybe you are looking for