0

This happened with the Nexus 7 device. I have tested on Samsung devices and it's working properly. Also with the Nexus 7 device, the Cancel button is not showing at all.

Thanks in advance.

Gaurav Darji
  • 488
  • 5
  • 12

1 Answers1

0

So, the trick is to provide a null listener to be stored as the listener, and then roll your own set of buttons REFERENCE

    DatePickerDialog picker = new DatePickerDialog(
        this,
        null, // instead of a listener
        2012, 6, 15);
    picker.setCancelable(true);
    picker.setCanceledOnTouchOutside(true);
    picker.setButton(DialogInterface.BUTTON_POSITIVE, "OK",
        new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.d("Picker", "Correct behavior!");
            }
        });
    picker.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", 
        new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.d("Picker", "Cancel!");
            }
        });
picker.show();
Community
  • 1
  • 1
kAnNaN
  • 3,669
  • 4
  • 28
  • 39