2011-03-01 5 views

Répondre

-3

utilisation JOptionPane:

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

} 
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(); 
0

Je suis venu ici tard, mais peut-être utile à quelqu'un à l'avenir:

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

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

Le troisième paramètre indique l'option sélectionnée par défaut qui est défini sur l'option Yes.

Voici un article sur la façon de travailler avec différents types of Blackberry dialogs.

Questions connexes