展会之一进度仅在Android上的时间对话框? [英] Show one progress dialog only at a time in android?

查看:163
本文介绍了展会之一进度仅在Android上的时间对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道Android的支持多个对话?因为当我第一次打开对话框。我允许用户点击取消,这将打开多一个对话框,以确认用户要退出是否,问题是,如果用户不想退出,原来的对话框就会消失,如何解决这一问题?谢谢

I wonder android support multiple dialog? Since when I first open the dialog. I allow user to click cancel, that will open one more dialog to confirm whether the user want to exit , the problem is if the user do not want to exit, the original dialog will disappear, how to fix the problem? Thanks

public static ProgressDialog showProgressDialog(final Context ctx, boolean isCancelable) {
    ProgressDialog dialog =  new ProgressDialog(ctx);
    dialog.setCancelable(false);
    dialog.setTitle(ctx.getResources().getString(R.string.system_info));
    dialog.setMessage(ctx.getResources().getString(R.string.downloading));
    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.setProgress(0);

    if (isCancelable){
        dialog.setButton(DialogInterface.BUTTON_NEGATIVE, ctx.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                AlertDialog.Builder builder = new Builder(ctx);
                builder.setMessage(R.string.cancel_offline_mode);
                builder.setTitle(R.string.system_info);
                builder.setPositiveButton(ctx.getResources().getString(R.string.confirm), new OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
                builder.setNegativeButton(ctx.getResources().getString(R.string.cancel), null);
                builder.create().show();
            }
        });
    }
    return dialog;
}

更新:

下面是我想什么期望:


  1. 显示下载进度的第一个对话框(如下载的60%等。)

  2. 在第一个对话框中有一个取消按钮,如果点击它显示在第二个对话框

  3. 第二个对话框要求确认是否取消下载

  4. 如果确认,不取消()...

  5. 如果没有,返回第一个对话框并显示百分比

感谢

推荐答案

这是我的函数中,首先对话框打开其中有写着拍照,添加视频..当你点击拍照然后又dialoge开放具有写着相机或画廊等etc..hope这是你的工作。

This is my function in which first of all dialog open which have says "take picture","Add Video"..when you click on "take picture" then another dialoge open which have says "camera" or "gallery" etc etc..hope it's work for you.

private void popupPhotoSelector(){
      Utilities.alert_video("", null, 
     // Utilities.alert("", null,
        new AlertDialogActionSettings("Take Picture", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                overwritePhoto = true;
                takePicture();
            }
        }), 
        new AlertDialogActionSettings("Gallery", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                overwritePhoto = true;
                openGallery();
            }
        }), 

         /////////////////////  Add Video //////////////////////////////
        new AlertDialogActionSettings("Add Video", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //Intent intent = new Intent(getBaseContext(), Main_Vevue_Activity.class);
                //startActivity(intent);
                AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                        context);
                // set title
                alertDialogBuilder.setTitle("MLI");
                // set dialog message
                alertDialogBuilder
                        .setMessage("Take Video From!")
                        .setCancelable(true)
                        .setPositiveButton("Camera",
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        overwritePhoto = true;
                                        takeVideo();
                                    }
                                })
                        .setNegativeButton("Gallery",
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        overwritePhoto = true;
                                        openGalleryForVideo();  
                                    }
                                });

                // create alert dialog
                AlertDialog alertDialog = alertDialogBuilder.create();

                // show it
                alertDialog.show();


            }
        }), 
         /////////////////////  Add Video End //////////////////////////////
        null, false
    );
}

这篇关于展会之一进度仅在Android上的时间对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆