Android 显示确认对话框

 

  AlertDialog.Builder builder = new AlertDialog.Builder(this);

              builder.setTitle("你确定要退出吗?");

              builder.setPositiveButton("确定",new DialogInterface.OnClickListener() {

                

                @Override

                public void onClick(DialogInterface dialog, int which) {

                    // TODO Auto-generated method stub

                    System.exit(0); 

                }

            });

              

             builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {

                

                @Override

                public void onClick(DialogInterface dialog, int which) {

                    // TODO Auto-generated method stub  

                    return;

                }

            });

               

              builder.show();

你可能感兴趣的:(android)