-2

I have this problem:

Builder
(android.content.Context)
in Builder cannot be applied
to
(anonymous android.content.DialogInterface.OnClickListener)

on the this code:

AlertDialog ventana;
    ventana=new AlertDialog.Builder(this).create();
    ventana.setTitle("COBARDE");
    ventana.setMessage("Rendidse es de debiles,a seguir jugando");
    ventana.show();
    ventana.setButton(8,"Confirmar", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogo1, int id) {
            aceptar();
        }
        public void aceptar(){
            AlertDialog ventana2;
            ventana2=new AlertDialog.Builder(this).create();
            ventana2.setTitle("puto");
            ventana2.setMessage("Rendidse es de debiles,a seguir jugando");
            ventana2.show();
        }

    });

can someone solve that?i am trying to put an alert dialog inside of another alert dialog

iRuth
  • 2,737
  • 3
  • 27
  • 32

1 Answers1

5

Instead of this (which is passing an instance of listener) please use MainActivity.this (or whatever the name of your activity is)

10101010
  • 607
  • 8
  • 24