When should I use say a DatePickerDialog over a DatePicker widget inflated in a DialogFragment? I've always done it the second way and have no idea when/how to use the first method. The same question applies to other picker widgets like TimePicker and TimePickerDialog as well.
Asked
Active
Viewed 1,661 times
1 Answers
4
Difference between DatePickerDialog
and DatePicker
DatePicker
- It is a Control by itself.DatePickerDialog
- It is a dialog with a date picker
When should I use ?
- Use
DatePicker
control in your activity layout (in case you have enough space) - Use the
DatePickerDialog
when you don't have enough space and/or if you want to open the date dialog in a separate view.
As per the doc, DatePickerDialog
is a
A simple dialog containing an DatePicker.
PS. In my experience, I would avoid using it the DatePicker
in the activity layout straight away because of space constraints. Consider devices like nexus 4 when you use them.

Jaswanth Manigundan
- 515
- 3
- 20
-
Thanks for the reply, can you explain what you mean by space constraints? Do you mean the size of the device? And why does that play a part in choosing which to use? – Luke Casey Aug 23 '16 at 10:28
-
Yes. That is my personal experience. What I actually meant was, all date pickers require a scroll view when you have other controls in the activity. When you want the users focus on the date picker alone, you might want to use it in a dialog. – Jaswanth Manigundan Aug 24 '16 at 23:22