Back to Top

How to create alert in android

Updated 18 June 2015

Some times it is a need to popup a message as warning message or alert message for the user and also give option to the user to close that popup after reading the message.
So following the below set of code you can do it easily.

1. Initialising.

AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Test Title").setPositiveButton("ok", new OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        dialog.dismiss();                        
    }
});

2. Execution

alert.setMessage("Your Warning Message").show();

Searching for an experienced
Magento Company ?
Find out More
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home