5

I am developing an app for android. I have created a timepickerdialog and a datepickerdialog, but the problem is, both of them run in different dialog boxes, which is not what the way I want my app to work :-S Is there any way to create a single dialogbox with both time and date picker dialog boxes in it together?

Thx

Pete Hamilton
  • 7,730
  • 6
  • 33
  • 58
ElTourero
  • 51
  • 1
  • 1
  • 2

3 Answers3

17

You can find a DateTimePicker implementation here:

http://code.google.com/p/datetimepicker/

BFil
  • 12,966
  • 3
  • 44
  • 48
  • Can't believe that this answer has no upvote and not the accepted one.. +1 because it gave me exactly what I was looking for :) – Vikas Gupta Jul 02 '13 at 06:31
  • I create project by using this source , make some changes and Migrating to Android Studio https://github.com/Kishanjvaghela/datetimepicker – Kishan Vaghela Sep 24 '15 at 04:52
2

I have created a custom Alert Dialog as in the Google tutorial. I replaced the ImageView and the TextView with a DatePicker and a TimePicker. I changed the following line:

View layout = inflater.inflate(R.layout.custom_dialog,
                           (ViewGroup) findViewById(R.id.layout_root));

with this:

View layout = inflater.inflate(R.layout.dialog_date_time, 
                           (ViewGroup) findViewById(R.id.datePicker));

For whatever reason the first gave an error, but the second worked. Anyway, I can use the two views in the same dialog window now.

Ovid
  • 113
  • 1
  • 1
  • 6
0

call time picker dialog in datepicker's update time method,It'll not be called at the same time but when you press datepicker's set button,Time picker dialog will open . The method is given in the answer of this link: DateTime picker in android application

Community
  • 1
  • 1
Jaydeep Khamar
  • 5,975
  • 3
  • 32
  • 30