3

I've integrated TimePicker in my application successfully. Now i would like to know is there a way to embed time picker in view instead of showing it as Dialog box. Thanks in advance.

enter image description here

Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60
Ramesh
  • 1,252
  • 3
  • 12
  • 30

2 Answers2

2

I suggest you , it is good habit to use fragment.if you use the DialogFragment ,google provide using the dialog frament for time picker http://developer.android.com/guide/topics/ui/controls/pickers.html#TimePicker

or

I found some link it can help you http://examples.javacodegeeks.com/android/core/ui/timepicker/android-time-picker-example/

  • Thank you @Virendra, your second link has provided some good information. To embed timepicker in view all we need to do is use this tag. – Ramesh Nov 04 '14 at 07:06
2

Actually showing in a DialogFragment is considered best practice. Still if you want to create similar view in your layout then I guess your best bet would be using wheel-view to achieve this.

Here is a library for it: https://code.google.com/p/android-wheel/ and its other implementation: https://github.com/ai212983/android-spinnerwheel

In case you want to stick with DialogFragment(recommended), here is a tutorial: http://androidician.wordpress.com/2014/09/20/android-date-picker-and-time-picker-example/

Ayush Goyal
  • 2,079
  • 8
  • 32
  • 47