如何在警报对话框运行时运行进度对话框

时间:2012-07-13 08:06:53

标签: android progressdialog android-alertdialog

我有一个AlertDialog项目列表。当我点击AlertDialog的某个项目时,我想要运行ProgressDialog

我该怎么做?

这是我的代码的一部分:

final CharSequence[] items = { "Detalles", "Reprogramarlo",
    "Ejecutarlo", "Cancelarlo", "Evaluación" };

AlertDialog.Builder builder = new AlertDialog.Builder(
    SeleccionarServicio.this);
builder.setTitle("¿Qué quiere hacer?");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {

    if (items[item].equals("Detalles")) {


    }

    if (items[item].equals("Reprogramarlo")) {

    }

    if (items[item].equals("Ejecutarlo")) {
        //Here I want to run progress dialog

        final ProgressDialog pd = ProgressDialog.show(SeleccionarServicio.this, "Medidas a Adoptar",
                "Comprobando Medidas...");
        new Thread(new Runnable() {
            public void run() {
                app.ActualizarMedidasAdoptar(clickedObject.getNumeroCliente(), clickedObject.getCodigoObra());


                pd.dismiss();

            }
        }).start();

        }                           
        });
    }

    if (items[item].equals("Cancelarlo")) {
        DilogCancelarServicio();
    }

    if (items[item].equals("Evaluación")) {

    }

}
});
AlertDialog alert = builder.create();

alert.show();

}

提前致谢。

0 个答案:

没有答案