Rachelle
Rachelle

Reputation: 33

Android- Opening Datepicker from EditText

I'm trying to figure out how to click/focus on an EditText field and open a DatePicker- preferably in place of the keyboard rather than as a Dialog, but I'll take whatever at this point. I would like to stay away from using TextView as a button that activates a Datepicker if at all possible though.

Due to this demographic http://developer.android.com/about/dashboards/index.html the customer would like versions 10 and up to be supported.

I've read many questions about this, but so far every answer has had deprecated functions (ie, showDialog) or uses functions that require API 11 (ie, DialogFragment).

Any ideas on how to proceed? Thanks so much!

Upvotes: 3

Views: 2313

Answers (1)

robzon
robzon

Reputation: 36

If I understand your issue correctly, here's a lib that does exactly what you want (works with API level 8+):

https://github.com/robzon/android-datepicker

Also, showing a datepicker in place of keyboard is how you'd do it on iOS - on Android you should show a dialog.

Upvotes: 2

Related Questions