getActiveChoice());
add(_choiceField);
// Menu item to initiate outgoing call with the selected line
final MenuItem _callWithSelectedLineMenuItem =
new MenuItem(new StringProvider("Call With Selected Line"),
0x230010, 0);
_callWithSelectedLineMenuItem.setCommand(new Command(
new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
final String text = _basicEditField.getText();
if (text == null || text.trim().length() == 0) {
Dialog.alert("Please enter phone number");
} else {
final Choice choice =
(Choice) _choiceField
.getChoice(_choiceField
.getSelectedIndex());
try {
// If the selected line is not currently active,
// the
// following method call will set it as active
// as
// well as place the call.
Phone.initiateCall(choice.getLineId(), text);
} catch (final RadioException re) {
PhoneMultiLineDemo
.messageDialog("Phone.initiateCall(int, String) threw "
+ re.toString());
}
}
}
}));
addMenuItem(_callWithSelectedLineMenuItem);
final MenuItem _switchLineMenuItem =
new MenuItem(new StringProvider("Switch To The Selected Line"),
0x230020, 1);
_switchLineMenuItem.setCommand(new Command(new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)