lundi 13 février 2017

AlertDialog setOnShowListener never called

Vote count: 0

I am using a slightly different approach in order to keep the dialog open when a button is pressed:

AlertDialog.Builder builder = new AlertDialog.Builder(NewTableActivity.this);

                        final EditText titleText = new EditText(NewTableActivity.this);

                        builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener(){
                            public void onClick(DialogInterface dialogInterface, int i){
                        builder.setPositiveButton(R.string.ok, null);
                        final AlertDialog alertDialog = builder.create();
                        alertDialog.setOnShowListener(new DialogInterface.OnShowListener(){
                            public void onShow(DialogInterface dialogInterface){
                                Log.i("TEst", "Doung");
                                Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);

The dialog is opened a little lower (this works too), but the Log is never called

asked 1 min ago

Let's block ads! (Why?)

AlertDialog setOnShowListener never called

Aucun commentaire:

Enregistrer un commentaire