alertdialog机器人内部

alertdialog机器人内部

本文介绍了AlertDialog alertdialog机器人内部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想补充内alertdialog.But的alertdialog无法看到第二alertdialog..please帮我在此显示我的code

  AlertDialog alertDialog =新AlertDialog.Builder(myclass.this).create();
alertDialog.setTitle(第一警报);
alertDialog.setMessage(第一个警报preSS);
alertDialog.setButton(确定,新DialogInterface.OnClickListener(){
    公共无效的onClick(DialogInterface对话,诠释它){
        //在这里你可以添加功能
        dialog.cancel();

        AlertDialog alertDialog1 =新AlertDialog.Builder(myclass.this).create();
        alertDialog1.setTitle(第二个警告对话框);
        alertDialog1.setMessage(第二个警告对话框的详细信息);
        alertDialog1.setButton(扫描另一,新DialogInterface.OnClickListener(){
                           公共无效的onClick(DialogInterface对话,诠释它){
}}); }
 

解决方案

这是会是一个迟到的答案,但你可以创建内部onClickListener一个AlertDialog就像这样:

 公共无效的onClick(DialogInterface对话,诠释它){
                                // TODO自动生成方法存根
                                如果(选项[这] ==管理){

                                }
                                其他 {
                                    dialog.dismiss();
                                    最后AlertDialog警报;

                                    AlertDialog.Builder dialog2 =新AlertDialog.Builder(CategoryPage.this);
                                    警报= dialog2.create();
                                    alert.setTitle(删除+标题+?);
                                    alert.setMessage(你确定要删除此类别?);

                                    alert.setButton(是,新DialogInterface.OnClickListener(){

                                        公共无效的onClick(DialogInterface对话,诠释它){
                                            // TODO自动生成方法存根
                                            Toast.makeText(CategoryPage.thisYESS,Toast.LENGTH_LONG).show();
                                        }
                                    });

                                    alert.setButton2(否,新DialogInterface.OnClickListener(){

                                        公共无效的onClick(DialogInterface对话,诠释它){
                                            // TODO自动生成方法存根
                                            alert.dismiss();
                                        }
                                    });

                                    alert.show();
                                }
                            }
                        });
 

I am trying to add an alertdialog within an alertdialog.But not able to see the second alertdialog..please help mehere is my code shown

AlertDialog alertDialog = new AlertDialog.Builder(myclass.this).create();
alertDialog.setTitle("First alert");
alertDialog.setMessage("first alert press");
alertDialog.setButton("ok", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
        // here you can add functions
        dialog.cancel();

        AlertDialog alertDialog1 = new AlertDialog.Builder(myclass.this).create();
        alertDialog1.setTitle("second alert dialog");
        alertDialog1.setMessage("second alert dialog details");
        alertDialog1.setButton("Scan Another", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int which) {
}}); }
解决方案

It is gonna be a late answer but you can create an AlertDialog inside onClickListener just like this:

public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub
                                if (options[which] == "Manage") {

                                }
                                else {
                                    dialog.dismiss();
                                    final AlertDialog alert;

                                    AlertDialog.Builder dialog2 = new AlertDialog.Builder(CategoryPage.this);
                                    alert = dialog2.create();
                                    alert.setTitle("Delete " + title + "?");
                                    alert.setMessage("Are you sure you want to delete this category?");

                                    alert.setButton("Yes", new DialogInterface.OnClickListener() {

                                        public void onClick(DialogInterface dialog, int which) {
                                            // TODO Auto-generated method stub
                                            Toast.makeText(CategoryPage.this, "YESS", Toast.LENGTH_LONG).show();
                                        }
                                    });

                                    alert.setButton2("No", new DialogInterface.OnClickListener() {

                                        public void onClick(DialogInterface dialog, int which) {
                                            // TODO Auto-generated method stub
                                            alert.dismiss();
                                        }
                                    });

                                    alert.show();
                                }
                            }
                        });

这篇关于AlertDialog alertdialog机器人内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 01:03