J2ME, Canvas, CommandListener.

Discussion in 'Java' started by boki, Mar 28, 2005.

  1. boki

    boki Guest

    Hi All,
    When I change the screen of phone(emulator) from myMIDlet.java
    to myGUI.java, I can see the soft buttons I created in myGUI.java, but
    the commandAction () of myGUI.java didn't response any soft button
    event.

    /////// Activate MIDlet ///////
    ....
    ....
    display = Display.getDisplay(this);
    display.setCurrnet(gui);
    ....
    ==> Phone screen change to myGUI.java, and I can see the soft buttons
    I created.

    ==> but, even I pressed the soft button, the commandAction () of
    myGUI.java didn't get a entry point( My System.out.println("XXX"
    didn't show), the commandAction () of myMIDlet neither.


    Thank you very much for your help.
    Best regards,
    Boki.
    boki, Mar 28, 2005
    #1
    1. Advertising

  2. (boki) writes:

    > When I change the screen of phone(emulator) from myMIDlet.java
    > to myGUI.java, I can see the soft buttons I created in myGUI.java, but
    > the commandAction () of myGUI.java didn't response any soft button
    > event.


    It's not sufficient to implement CommandListener, you also need to
    call setCommandListener(this) in the gui class.
    Tor Iver Wilhelmsen, Mar 28, 2005
    #2
    1. Advertising

  3. boki wrote:
    > Hi All,
    > When I change the screen of phone(emulator) from myMIDlet.java
    > to myGUI.java, I can see the soft buttons I created in myGUI.java, but
    > the commandAction () of myGUI.java didn't response any soft button
    > event.
    >
    > /////// Activate MIDlet ///////
    > ....
    > ....
    > display = Display.getDisplay(this);
    > display.setCurrnet(gui);
    > ....
    > ==> Phone screen change to myGUI.java, and I can see the soft buttons
    > I created.
    >
    > ==> but, even I pressed the soft button, the commandAction () of
    > myGUI.java didn't get a entry point( My System.out.println("XXX"
    > didn't show), the commandAction () of myMIDlet neither.


    Is your instance of myGUI registered as the CommandListener for its
    Command events?

    --
    Darryl L. Pierce <>
    Visit my homepage: http://mcpierce.multiply.com
    "By doubting we come to inquiry, through inquiry truth." - Peter Abelard
    Darryl Pierce, Mar 28, 2005
    #3
  4. boki

    boki Guest

    Tor Iver Wilhelmsen <> wrote in message news:<>...
    > (boki) writes:
    >
    > > When I change the screen of phone(emulator) from myMIDlet.java
    > > to myGUI.java, I can see the soft buttons I created in myGUI.java, but
    > > the commandAction () of myGUI.java didn't response any soft button
    > > event.

    >
    > It's not sufficient to implement CommandListener, you also need to
    > call setCommandListener(this) in the gui class.


    Ya, it's my fault..., I fixed it. Thank you very much!

    Best regards,
    Boki.
    boki, Mar 28, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mchmiel
    Replies:
    2
    Views:
    3,785
    Tim Tyler
    Jul 5, 2003
  2. Boki
    Replies:
    3
    Views:
    1,004
    Darryl Pierce
    Apr 1, 2005
  3. Askari
    Replies:
    2
    Views:
    698
    Askari
    Aug 30, 2004
  4. PhilC
    Replies:
    2
    Views:
    869
    PhilC
    Oct 25, 2004
  5. Replies:
    10
    Views:
    251
    Rick Johnson
    Mar 15, 2013
Loading...

Share This Page