Smith
Smith

Reputation: 423

How to achieve Local Notification in android 2.3.1?

any one know how to achieve local notification in android.currently i am working on Android2.3.1 please help to achieve it....

Thanks in Advance---

Upvotes: 0

Views: 344

Answers (1)

FoamyGuy
FoamyGuy

Reputation: 46856

I seems from your comment that you are looking for a Dialog not a notification. This code will give you a dialog with a yes and no button.

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Put your question here?")
    .setCancelable(false)
    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // put your code here
        }
    })
    .setNegativeButton("No", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // put your code here 
            dialog.cancel();
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();

Upvotes: 2

Related Questions