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



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


MSA ALTAIR 4XR picture

MSA ALTAIR 4XR

$600.00



MSA Altair Pro O2 10400402 Single-Gas Detector Oxygen (O2) Used Works picture

MSA Altair Pro O2 10400402 Single-Gas Detector Oxygen (O2) Used Works

$79.99



MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated picture

MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated

$340.00



MSA ALTAIR 4XR Multigas Detector, LEL, O2, CO, H2S 10178557 picture

MSA ALTAIR 4XR Multigas Detector, LEL, O2, CO, H2S 10178557

$739.00



MSA ALTAIR H2S SINGLE GAS DETECTOR 10071361 picture

MSA ALTAIR H2S SINGLE GAS DETECTOR 10071361

$217.55



MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated picture

MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated

$450.00







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