How to implement date picker dialog like the one in the image below.
Asked
Active
Viewed 668 times
-3
-
sorry but not able to see your image. – KDeogharkar Mar 23 '16 at 09:21
-
but I can see clearly. – Geethakrishna Juluri Mar 23 '16 at 09:26
-
dont know whether issue is from my desktop . let me check – KDeogharkar Mar 23 '16 at 09:26
3 Answers
1
public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
}
To show time picker,
public void showTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getSupportFragmentManager(), "timePicker");
}

Silvans Solanki
- 1,267
- 1
- 14
- 27
1
It depends on you SDK version. If you really need the same look on older versions of Android, you can use this library. I've used it before and it is awesome! It requires API 14 (Ice Cream Sandwich)
https://github.com/wdullaer/MaterialDateTimePicker
It might also be worth checking out this library:
https://github.com/vikramkakkar/SublimePicker
0
Depends of your min. SDK! If you have 5.0 or more, this version have it as normal component, but if you have less version then you need to use a external library. You can find this libraries, for example here or here.
Tell me if I helps you and good programming!

Merlí Escarpenter Pérez
- 2,569
- 3
- 26
- 49