1
votes

Hello I m working on j2me application. There is one form in which I had used the choicegroup(check box).Now I want that whenever user select the options of the choicegroup(check box) one POP-up or dialogbox or Alert which ask user that if you select this item.Then this item get deleted form the list. The POP-up or dialogbox or Alert contain:-

Text :--Do you want to delete this item?

Two command or two options or button :--1)YES 2)NO

If I keep alert then can I able to keep two command in it?

1

1 Answers

1
votes

Create an alert

alert = new Alert("alert");
alert.addCommand(new Command("Ok", Command.OK, 0));
alert.addCommand(new Command("Cancel", Command.CANCEL, 0););
alert.setCommandListener(this);
alert.setTimeout(Alert.FOREVER);

And in CommandAction

 if (displayable == alert) {
        if (command == cancelCommand) {
                //user denied
        } else if (command == okCommand1) {
              //user accepts
        }
    }