I am using compile 'com.wdullaer:materialdatetimepicker:2.3.0' library for Open and Close Hour (AM & PM). I would like to show TimePickerDialog again for PM after user chooses AM. And then, I would like to show AM+PM data on TextView. Here is One TimePickerDialog.
layout_time.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
MainActivity.this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
false
);
tpd.show(getFragmentManager(), "Timepickerdialog");
}
});
@Override
public void onResume() {
super.onResume();
TimePickerDialog tpd = (TimePickerDialog) getFragmentManager().findFragmentByTag("Timepickerdialog");
if (tpd != null) tpd.setOnTimeSetListener(this);
}
@Override
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
String time = hourOfDay + ":" + minute + " am";
txt_time.setText(time);
}