Can any one post sample code for a simple date picker in Android.
If date picker is not possible in Android, an option to choose a date is needed.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the DatePicker
http://developer.android.com/reference/android/widget/DatePicker.html
It is availible since API Level 1
Here a example how to use the DatePickerDialog.
First add a TextView and a Button to your layout.xml
Next you have to initialize the Button and TextView in the onCreate Method of your layout.
You need this class variables
Here the onCreate method
UpdateDisplay method:
The callback listener for the DatePickDialog
The onCreateDialog method, called by showDialog()
Hope it helps, used it and it works fine.
Example from
http://developer.android.com/guide/tutorials/views/hello-datepicker.html