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();

 

posted @ 2014-09-25 17:14  feiling  阅读(170)  评论(0编辑  收藏  举报