Good community.
I have a method that takes a confirmation dialog, if you click on accept a dialog box comes out while sending data by firebase
, first take the box and then send the data. The issue is that the table is not shown but that they send the data, which is what it is supposed to be after. I have created a variable of the class of Dialog
to save the AlertDialog
that returns the builder
when doing the .show()
to be able to do dismiss()
of the dialog when it finishes sending everything. The problem is that the box is never shown. I hope you can help me. Greetings and thanks.
private void dialogoConfirmacion() {
AlertDialog.Builder builder=new AlertDialog.Builder(getContext());
builder.setTitle(R.string.informacion)
.setMessage(R.string.infoIncidenciaEnviar)
.setPositiveButton(R.string.aceptar, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
lanzarCuadro();
}
})
.setNegativeButton(R.string.cancelar, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.create();
builder.show();
}
private void lanzarCuadro(){
builder = new AlertDialog.Builder(getContext());
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.cuadro_carga_subir, null);
tituloCuadro=view.findViewById(R.id.txt_titulo_cuadro_carga_subir);
subtituloCuadro=view.findViewById(R.id.txt_texto_ayuda_cuadro_carga_subir);
barraCuadro=view.findViewById(R.id.barra_cuadro_carga_subir);
barraCuadro.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
tituloCuadro.setText(R.string.subiendoImagenes);
builder.setView(view);
builder.setCancelable(false);
builder.create();
dialogo=builder.show();
dialogo.create();
dialogo.show();
new Runnable(){
@Override
public void run() {
enviarConfirmado();
}
}.run();
}