Search This Blog

Friday, 15 June 2012

How to display a dialog with yes and no option on close

Hello friends,
                     Still following those bulky confusing tutorials to just display a simple Dialog box for confirmation??? Here it is , i found it yesterday and tried it ...it works....

CODE:

suppose you have a screen and on back button click you want to ask the user if he is sure or not....

so override the onClose function like this...


public boolean onClose(){
    int st = Dialog.ask(Dialog.D_YES_NO,"Are you Sure?");
   if(st==Dialog.YES){
      System.exit(1);
      return true;
     }    
     return false;
}



No comments:

Post a Comment