1

How do I display a dialog to the user asking him if he wants to continue, with a choice of yes or no?

Benjol
  • 63,995
  • 54
  • 186
  • 268
varunrao321
  • 925
  • 2
  • 10
  • 18

4 Answers4

0
Dialog d = new Dialog("Do you want to continue?", new String[]{"Yes","No"},  new int[]{Dialog.OK,Dialog.CANCEL}, Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.QUESTION)){
                    public void setChangeListener(FieldChangeListener listener) {
                        if(d.getSelectedValue() == Dialog.OK){
                             //true part                                
                        }
                        else{
                             //false part
                        }
                    };
                };
d.show();
vajapravin
  • 1,363
  • 3
  • 16
  • 29
0

Came here late but maybe helpful to someone in future:

int ans =  Dialog.ask(Dialog.D_YES_NO, "Do you want to continue?", Dialog.YES);

    if (ans == Dialog.YES) 
        // Continue
    else
        // Do not Continue

The third parameter states the default selected option which is set to the Yes option.

Here's an article on how to work with different types of Blackberry dialogs.

ThePCWizard
  • 3,338
  • 2
  • 21
  • 32
0

You need to use one of the Dialogs provided by BB like Dialog.ask(someNumber,"Your message");

tipycalFlow
  • 7,594
  • 4
  • 34
  • 45
-3

use JOptionPane :

int res = JOptionPane.showConfirmDialog(null,"Do you want to continue ?");
if (int == 0){
   // code for continue
}
else {

}
Bartzilla
  • 2,768
  • 4
  • 28
  • 37
sajad
  • 2,094
  • 11
  • 32
  • 52