Android开发-- 简单对话框

 1 final Builder builder = new AlertDialog.Builder(this);
 2 builder.setIcon(R.drawable.appicns_folder_smart);
 3 builder.setTitle("Normal Dialog");
 4 builder.setMessage("A simple dialog");
 5 builder.setPositiveButton("OK", new OnClickListener() {
 6                     
 7     @Override
 8     public void onClick(DialogInterface arg0, int arg1) {
 9         toast.setText("User has clicked OK button.");
10         toast.show();
11         }
12     });
13                 
14     builder.setNegativeButton("Cancel", new OnClickListener() {
15                     
16     @Override
17     public void onClick(DialogInterface arg0, int arg1) {
18         toast.setText("User has clicked Cancel button.");
19         toast.show();
20         }
21     });
22 builder.create().show();
原文地址:https://www.cnblogs.com/feiling/p/3993243.html