allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ishwarverma39:dateTimePicker:v1.0.1'
}
(See SampleActivity for a more complete example)
First create a listener object:
private DateTimeSetListener dateTimeSetListener = new DateTimeSetListener() {
@Override
public void onDateTimeSet(Date date) {
Log.d("onDateTimeSet", "===" + date.toString());
}
};
Then pass the listener into the builder and show the dialog:
DateTimePicker dateTimePicker =
new DateTimePicker.Builder()
.setSelectedDate(Calendar.getInstance().getTime())
.setDateTimeSetListener(dateTimeSetListener)
.build();
dateTimePicker.show(getSupportFragmentManager());