Search This Blog

Wednesday 1 August 2012

Date Time Picker in android

We know how simple is to create Date Picker Dialog and  Time Picker Dialog ! but so what about a situation where we  need to pick Time and Date both at once with all attributes e.g AM_PM, second, minute, Hour, Month, Year etc. We got stuck  right?

I have search a lot about this on Google but i did not find efficient and easy solution. So decide to write about this important concept. While you are developing any android application then you just copy one class from my sample project. and your work has done.

There are two simple step to understand what's going on in my project

1) Create object of CustomDateTimePicker with two argument Your Current activity context and one Call back listener so that when you select time and date, it will return result

2) CustomDateTimePicker has number of method to fulfill your custom requirement like---


/**
* Pass Directly current time format it will return AM and PM if you set
* false
*/
custom.set24HourFormat(false);

                 /**
* Pass Directly current data and time to show when it pop up
*/
custom.setDate(Calendar.getInstance());

Custom is instance of my CustomDateTimePicker .Except this , CustomDateTimePicker  has number of method. 


                       The Output of my sample project will be like these screen shot.

Date time Picker
Date And Time Picker

Selected Value
          
                                                       

                                                              Download Source Code


6 comments:

  1. I wonderment why other professionals don't respond your website overmuch m happy I plant this.
    one click root

    ReplyDelete
    Replies
    1. Thank you ..I think every process take time. I am new blogger just start blogging few month ago.Everything will fall in place when time will come. Any way thank you for your support

      Delete
  2. This is awesome work Tofeeq. You really are not getting the kind of applause you deserve especially since this is so much better than what I have seen being shown around. Great work!!

    ReplyDelete
    Replies
    1. Thank you Daniel..This is my big achievement that i have a reader like you. Keep visiting this blog

      Delete
  3. Hi tofeeq, this is exactly what I was looking for my application (assuming Calendar grid widget is not common yet) I have tested it it within the application and it works great. cool work! Can I have your permission to use it?

    ReplyDelete
    Replies
    1. Thank you..and i am glad that you like it. Feel free to use all my stuff present on this blog

      Delete

Feedback always help in improvement. If you have any query suggestion feel free to comment and Keep visiting my blog to encourage me to blogging

Android News and source code