Monday, 6 July 2015

ALERT DIALOG BOX - 1



This dialog box is very much useful when we want to inform or notify the user something important.

Alert dialog looks like 



The java code for this is 

   


new Builder(this)

//This is for title ,Ex.Argh in above image
               
.setTitle("Argh")
               
//This is for showing message in dialog box ,Ex. Watch out
               
.setMessage("Watch out")
               
//This could be used for "ok","close","Exit" ,Ex. close
               
.setNeutralButton("Close", new DialogInterface.OnClickListener() {
                   
       @Override
       public void onClick(DialogInterface dialog, int which) {
           // TODO Auto-generated method stub
                       
           /*Here paste the code which user has to perform when he selects Close in dialog box*/
                       
           /*generally we can use the  code which takes user to the settings of android device
             so he/she can selects either wifi or mobile data for internet connection if required by app*/
                        
            /*you can get that code from below link*/
                       
                   }
               }).show();



The below code is to redirect app to settings .Have a look it at

http://www.testedcodes.net/2015/07/to-link-to-settings-from-our-app-in.html




No comments:

Post a Comment