Example usage for android.app DatePickerDialog getButton

List of usage examples for android.app DatePickerDialog getButton

Introduction

In this page you can find the example usage for android.app DatePickerDialog getButton.

Prototype

public Button getButton(int whichButton) 

Source Link

Document

Gets one of the buttons used in the dialog.

Usage

From source file:at.jclehner.rxdroid.DatePickerFragment.java

@Override
public void onShow(DialogInterface dialogInterface) {
    if (Version.SDK_IS_JELLYBEAN_OR_NEWER) {
        final DatePickerDialog dialog = (DatePickerDialog) dialogInterface;
        dialog.getButton(Dialog.BUTTON_POSITIVE).setOnClickListener(new OnClickListener() {

            @TargetApi(11)/*www. j  a v  a  2 s . c o m*/
            @Override
            public void onClick(View v) {
                final DatePicker picker = dialog.getDatePicker();
                mListener.onDateSet(picker, picker.getYear(), picker.getMonth(), picker.getDayOfMonth());
                dialog.dismiss();
            }
        });
    }
}