×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2003
    Location
    Kaliningrad, Russia
    Posts
    5

    Series 60 & Command.EXIT

    Hi,

    Could somebody help me with following code.
    I trying to catch Command.EXIT on Nokia S60.
    When I run this midlet on 6310i emulator or
    Sun J2ME wtk 1.0.4 it works fine (i'm getting
    the "Test" command binded to one of soft keys).
    But when I'm trying to run this code on Series 60
    emulator or real phone (N7650) I'm getting menu
    "Options" binded to left soft key with sigle
    item "Exit" inside. And selection of this item doesn't
    affect calling of commandAction method of MyCanvas
    class.

    So, the question is it possible to remove or handle
    somehow "Exit" menu item on Series 60 phones?

    Vadim.


    package menutest;

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

    public class MenuTest extends MIDlet
    {
    MyCanvas screen = null;

    public MenuTest()
    {
    screen = new MyCanvas();
    }
    protected void startApp()
    {
    Display.getDisplay(this).setCurrent(screen);
    }
    protected void pauseApp()
    {
    }
    protected void destroyApp(boolean parm1)
    {
    Display.getDisplay(this).setCurrent(null);
    notifyDestroyed();
    }
    }

    class MyCanvas extends Canvas implements CommandListener
    {
    public MyCanvas()
    {
    addCommand(new Command("Test", Command.EXIT, 0));
    setCommandListener(this);
    }

    protected void paint(Graphics gr)
    {
    }

    public void commandAction(Command c, Displayable d)
    {
    System.out.println(c.getLabel());
    }
    }

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    10
    You can't override 'default' Exit comand in Nokia 60s. Here what is written in the "Designing Java Application For Series 60" book ....
    -------
    The Series 60 MIDP implementation automatically adds an "Exit" option to
    the command menu. When the automatically added "Exit" is selected by the user, the
    destroyApp() method of the MIDlet is called. There is no way to override this behavior.
    A developer specified "Exit" command would cause two "Exit" options to be added to the
    menu and potentially confuse the user. However, if the MIDlet needs to be portable, an
    "Exit" command must be specified. A developer therefore needs to weigh the need for
    portability against the potential confusion to the user of having two "Exit" options on the
    menu.
    This behavior has some repercussions for application design. If a user chooses the "Exit"
    option from the menu, the MIDlet will not be able to display a screen requesting information from the user, for example a "Would you like to save the data?" message,
    because the screen is not accessible once destroyApp() has been called.
    -------
    In my opinion this is very stupid behavior for series 60s but who am I to judge Nokia.

    Emil

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    26
    I agree with Emil, i think Nokia should leave the decision adding and removing commands to the developers, not to the firmware. It causes unneccesary problems with portability.

    regards
    elwoodini

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    Malaysia-Johor-Pontian Kecil
    Posts
    163
    Hi,

    There is any ways to know implementation for the S60, S40 or etc has the default commands in order to determine I wether need to add my own command. For S40 emulator, initially, "OK" / "Select" would be added in the Displayable. If I can know the "OK" / "Select" is exist, I don't need to add "OK" / "Select" command and I can use them instead. Is it possible ?

    Please give me some comments.

    Regard,
    chai

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    5
    yes, the Exit button is a huge problem for me. I am trying to write an application that can have only one exit. It seems on the series 60 phones there an exit on every page. I have tried traping it in destroyApp but I can not. This is a big problem for this particular app.

    has anyone found a workaround, or know if Nokia might change this feature/bug in the future. this really should be left up to the developer.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    19
    Yes, this is a UI nightmare. Why Nokia, why?

  7. #7
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    Solution: use a FullCanvas. Series 60 phones are high end phones and this gives you more room to add stuff like a FullCanvas with your own implementation of addCommand(), and setCommandListener() (and maybe also setTitle() or any other method that exists in Canvas and not in FullCanvas), where you are responsible for drawing the buttons, and capturing and redirecting the events to the listener.
    This solution will help with portability issues because then you only have to change all the references to Canvas objects and change them to a MyCustomFullCanvas object.

    Still, I agree with what has been said here and I also think that future versions of Series 60 phones shouldn't add any default Commands.

    shmoove

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    27

    Default Exit calls notifyDestroyed()

    Correct me if I'm wrong but the default exit appears to call notifyDestroyed() rather than destroyApp(). When I use the default close my app does NOT run its cleanup routines. But if I call destroyApp() the routines run. This is on a Nokia 6600.

  9. #9
    Registered User
    Join Date
    Sep 2004
    Posts
    7

    how to remove form's exit command

    when I use a form to show message(not a canvas). How Can I remove the Exit Command?
    3q everybody

  10. #10
    Registered User
    Join Date
    Sep 2009
    Posts
    1

    Re: Series 60 & Command.EXIT

    well i also have problem with nokia series 40 plattform.....2 select options one from me n other default....2 exit commands also..my application rocks!

  11. #11
    Regular Contributor
    Join Date
    Dec 2008
    Location
    Mumbai
    Posts
    199

    Smile Re: Series 60 & Command.EXIT

    hi frnd

    we cant play with Exit Button on s60 device..
    even we cant set Left soft Command and right soft Command also

    thanks
    Ajay Prajapati
    Mobile Software Developer
    Mumbai,India

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×