// A MenuItem to start the diagnostic test
final MenuItem startTestItem =
new MenuItem(new StringProvider("Start Test"), 0x300010, 0);
;
startTestItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
// Format the UI for output
showOutputFields();
// Begin test
if (_locThread != null) {
if (!_locThread.isStopped()) {
_locThread.stop();
}
}
_log.setText("");
log("Extended GPS API test starting");
log("Device: " + DeviceInfo.getDeviceName());
log("Device Software: " + DeviceInfo.getSoftwareVersion());
log("Carrier: " + RadioInfo.getCurrentNetworkName());
_locThread = new LocationThread();
_locThread.start();
}
}));
addMenuItem(startTestItem);
_stopTestItem =
new MenuItem(new StringProvider("Stop Test"), 0x300020, 1);
_stopTestItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
// Stop the thread
log("Stopping test");
_locThread.stop();
_locThread = null;
}
}));
addMenuItem(_stopTestItem);
// A MenuItem to display the help dialog
final MenuItem helpItem =
new MenuItem(new StringProvider("Help"), 0x300030, 2);
helpItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,