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

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。