对话框

AlertDialog.Builder builder = new Builder(MainActivity.this);
                builder.setMessage("是否确认删除!")
                        .setPositiveButton("确认",
                                new DialogInterface.OnClickListener() {

                                    @Override
                                    public void onClick(DialogInterface dialog,
                                            int which) {
                                        // TODO Auto-generated method stub
                                  
                                        dialog.dismiss();
                                        Toast.makeText(MainActivity.this,
                                                "删除成功", 0).show();
                                    }
                                })
                        .setNegativeButton("取消删除",
                                new DialogInterface.OnClickListener() {

                                    @Override
                                    public void onClick(DialogInterface dialog,
                                            int which) {
                                        // TODO Auto-generated method stub
                                        dialog.cancel();
                                        Toast.makeText(MainActivity.this, "取消成功",
                                                0).show();
                                    }
                                }).create().show();
复制代码
posted @ 2016-05-03 15:59  夏夜微凉  阅读(115)  评论(0编辑  收藏  举报