BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-27-2010, 01:02 AM   #1
Emmett
New Member
 
Join Date: Feb 2009
Model: 9700
PIN: N/A
Carrier: SFR
Posts: 3
Default MIDlet button working differently on a BlackBerry 9700 than on the SUN WTK simulator

Please Login to Remove!

Hi,

I am trying to design a 2 button interface using MIDlet 2.0 and CLDC 1.1 but get a different behaviour on the WTK simulator and on a BlackBerry 9700.
On the WTK simulator, the command behind the button is fired as soon as the button is pressed through the trackpad.
On a BlackBerry 9700, the first click on the button through the trackpad brings up the screen command menu and a second click on the command listed in this menu and linked to the button is necessary.
How can I make the BlackBerry 9700 work as with the WTK simulator, i.e. fire the command as soon as the button is pressed through the trackpad?
I wish to stay on the JME model and not going to the RIM SDK.

Thanks

package UI;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.ItemCommandListener;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeExcepti on;

public class MyButton extends MIDlet implements ItemCommandListener {
Display display;
Form form;
Command okCommand, exitCommand;
protected void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);

form=new Form("2 button interface");

StringItem okButton=new StringItem(null, "Ok", Item.BUTTON);
okButton.setItemCommandListener(this);
okCommand=new Command("Ok",Command.ITEM, 0);
okButton.setDefaultCommand(okCommand);
okButton.addCommand(okCommand);
form.append(okButton);

StringItem exitButton=new StringItem(null, "Exit", Item.BUTTON);
exitButton.setItemCommandListener(this);
exitCommand=new Command("Exit",Command.ITEM, 0);
exitButton.setDefaultCommand(exitCommand);
exitButton.addCommand(exitCommand);
form.append(exitButton);

display.setCurrent(form);
}

public void commandAction(Command cmd, Item item) {
Alert alert=new Alert("Button pressed "+cmd.getLabel()+" "+item.toString());
display.setCurrent(alert);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
this.notifyDestroyed();
}

protected void pauseApp() {
}

}
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Complete Electronics Assortment Transistor W/ Clear Transparent Box Container
$19.05
Complete Electronics Assortment Transistor W/ Clear Transparent Box Container pictureUniversal IRF3205 Power Transistor 20pcs 55V/110A Accessory IRF MOSFET
$12.51
Universal IRF3205 Power Transistor 20pcs 55V/110A Accessory IRF MOSFET pictureThe Transistor and Diode Data Book for Design Engineers Texas Instruments 1973
$11.99
The Transistor and Diode Data Book for Design Engineers Texas Instruments 1973 picture4pcs 100*41*8mm Aluminum Heat Sink for Computer LED Power IC Transistor HPT
$16.82
4pcs 100*41*8mm Aluminum Heat Sink for Computer LED Power IC Transistor HPT picture6Pcs 100x41x8mm Aluminum Heat Sink for Computer LED Power IC Transistor HPT
$21.15
6Pcs 100x41x8mm Aluminum Heat Sink for Computer LED Power IC Transistor HPT picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.