I’m new to Android development so I apologize beforehand if you find my question too simple.
I followed the tutorial here to create a datepicker:
http://developer.android.com/guide/topics/ui/controls/pickers.html
It works but I’m wondering if there is a way to show the datepicker without having to click on a button?
Basically I want the datepicker to automatically show at the exact same location as my button right now. I’m thinking of just have an empty TextView and call showDatePickerDialog there but that obviously doesn’t work.
Here is the xml part for my current button:
<Button
android:id="@+id/pick_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pick_date"
android:onClick="showDatePickerDialog" />
Thank you!
There’s a DatePicker widget in Android. If you’re using Eclipse, check out the “Graphical Layout” of an XML file to see the available widgets.
This should do the trick: