Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Alert Dialog builder doesn't have dismiss or cancel method

I know that there are lot of solutions currently to this question, but i couldn't solve with any of them. Actually i created a imageView and i set a listener to that imageView, i also created a custom builder to create my own alertDialog, what i need is to close the dialog when i click on the imageView so i did something like this:

final AlertDialog.Builder builder = new AlertDialog.Builder(Friends.this);
LayoutInflater inflater = Friends.this.getLayoutInflater();
                final View dialogView = inflater.inflate(R.layout.custom_builder, null);
close.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                });
 builder.show();

this is just part of my code, the builder.show is working fine, the close is the name of my imageView.

Thank you very much guys.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

you have to add builder.create() method for dismiss dialog. get an instance and dismiss it.

final AlertDialog.Builder builder = new AlertDialog.Builder(Friends.this);
    AlertDialog dialogInstance=builder.create();
    LayoutInflater inflater = Friends.this.getLayoutInflater();
                    final View dialogView = inflater.inflate(R.layout.custom_builder, null);
                        close.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                        dialogInstance.dismiss()
                        }
                    });
     builder.show();

happy coding :)

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda