---
title: "AlertDialog"
author: "liangoogle"
date: "2011-06-08T16:45:48Z"
tags: []
categories: ["移动开发"]
slug: "alertdialog"
draft: false
lastmod: "2011-06-08T16:45:48Z"
id: 1073273
url: "https://liangoogle.iteye.com/blog/1073273"
---

new AlertDialog.Builder(Test.this)

 

                .setTitle("Question")

 

                .setMessage("Are you sure that you want to quit?")

 

                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {

 

                public void onClick(DialogInterface dialog, int whichButton) {

 

                setResult(RESULT\_OK);

 

                finish();

 

                }

 

                })

 

                .setNegativeButton("No", new DialogInterface.OnClickListener() {

 

                public void onClick(DialogInterface dialog, int whichButton) {

 

 

                }

 

                })

 

                .show();