Thursday, September 2, 2010

Androd Alert Dialog

Now you are familiar with the code and activity of the android.

We are going to write a code for the AlertDialog here to show the dialog box.

In your activity go to the onCreate method and paste the following code in the last of the method.


new AlertDialog.Builder(AddVisit.this)                                                                               
        .setTitle("My Alert Title")
         .setMessage("My dialog message body")
        .setNeutralButton("OK", new DialogInterface.OnClickListener() {
               
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                   
                }
            })
        .show();


After inserting this code you will see the dialog.

No comments:

Post a Comment