J2ME, Canvas, CommandListener.

B

boki

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.
 
T

Tor Iver Wilhelmsen

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.
 
D

Darryl Pierce

boki said:
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?
 
B

boki

Tor Iver Wilhelmsen said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top