Questions tagged [android-datepicker]

Android DatePicker is a widget for selecting a date. The date can be selected by a year, month, and day spinners or a CalendarView. The set of spinners and the calendar view are automatically synchronized.

Android DatePicker is a widget for selecting a date. The date can be selected by a year, month, and day spinners or a CalendarView. The set of spinners and the calendar view are automatically synchronized.

Android DatePickerDialog is a dialog that hosts a DatePicker widget.

786 questions
33
votes
8 answers

Android Calendar View for Date Picker

I'm writing my first app, and I have a question about DatePicker. My app requires the user to input a date. The most user-friendly way would be to popup a calendar-like widget that displays the current month like a calendar grid - something like…
ndtrek07
  • 499
  • 1
  • 4
  • 8
27
votes
9 answers

Casting and getting values from date picker and time picker in android

I have a DatePicker and a TimePicker in my app. Can anyone tell me how to get the values of the date and time that are selected??? What i mean to say is, for EditText we can declare as final EditText name = (EditText)…
Rahul Kalidindi
  • 4,666
  • 14
  • 56
  • 92
25
votes
3 answers

DatePicker crash in samsung with android 5.0

I am having trouble with creating a datepicker in samsung note 2 device with lollipop 5.0. The exception is: java.util.IllegalFormatConversionException: %d can not format java.lang.String arguments at…
25
votes
20 answers

Open a DatePickerDialog on Click of EditText takes two clicks

I want to open a Calendar on the click of Edit text. After that I want to set the date which the user selects from the Calendar in the edit text. Problem is that, only when I click on the EditText for the second time then the calendar open. Please…
Developer
  • 6,292
  • 19
  • 55
  • 115
23
votes
3 answers

Change DatePickerDialog's button texts

I'm having some trouble changing the text of the buttons of the dialog. I tried to use: setButton(int whichButton, CharSequence text, DialogInterface.OnClickListener listener) and setButton(int whichButton, CharSequence text,…
MatF
  • 1,728
  • 2
  • 14
  • 31
21
votes
7 answers

Android datepicker min max date before api level 11

I am trying to set the min and max date of the date picker in Android to before API level 11. I used the following code: mDatePickerField =…
Bahri Gökcan
  • 980
  • 3
  • 12
  • 20
20
votes
8 answers

Android DatePickerDialog: Set min and max date for selection

I know there are quite a lot of question for this but none of the solutions are working for me, so this question. I want to restrict user to select date before today, but am not able to do so. public class DatePickerDialogFragment extends…
Abdullah
  • 7,143
  • 6
  • 25
  • 41
20
votes
2 answers

Datepicker: How to popup datepicker when click on button and store value in variable

I want to show datepicker popup window. I have found some examples but i am not getting it properly. I have one button and i want that when i click on button the datepicker dialog should popup and after setting the date, the date should be stored in…
Ashish Patil
  • 471
  • 1
  • 9
  • 24
17
votes
4 answers

Can't get Android DatePickerDialog to switch to Spinner mode

I am building an app that uses a DatePickerDialog to allow the user to select their birthdate. Here's the code that loads the dialog right now: private void selectBirthdate() { int year, month, day; if (mBirthDate == null) { year =…
17
votes
4 answers

Android how to show DatePicker in Fragment?

I am new on Android Fragments and I want to know that how can I show or implement DatePicker in simple Fragmentand not a FragmentActivity. For example my class name is: public class FragmentAddCard extends Fragment { } Thanks.
user3555472
  • 836
  • 3
  • 11
  • 38
17
votes
5 answers

Setting MinDate on DatePicker moves CalendarView to 1964

I'm debugging an issue where the CalendarView in a DatePicker moves to October 1964 if there is a non-default minimum date set. This reproduces at least on API17 Nexus7 emulator but there are reports about this issue on other devices where the…
laalto
  • 150,114
  • 66
  • 286
  • 303
16
votes
2 answers

Android DatePicker shows unavailable months when using min/max limits

I've only found 1 other instance of this issue on StackOverflow which was unanswered (last year), so I figured I'd give it another shot. (Android DatePicker/Dialog displaying incorrect month/s using min/max date, with an actual image) When setting…
Kevin
  • 183
  • 8
16
votes
5 answers

How to Hide Past dates and restrict user to select future dates only

How to Hide past dates on DatePicker dialog ? I don't wanna allow user to select past dates What would be the best way ? if i want to restrict user to select future dates only ! @Override public void onCreate(Bundle savedInstanceState) …
Sun
  • 6,768
  • 25
  • 76
  • 131
13
votes
5 answers

Material Date Picker Custom Styling

i have used range date picker from google material with this library implementation 'com.google.android.material:material:1.2.0-alpha02' this is my code MaterialDatePicker.Builder> builder = …
13
votes
3 answers

How to configure DatePicker for date of birth date selection

With the default display the DatePicker shows the current month, but the user may wish to select a date which is hundreds of months previous. It is of course possible to tap the year and select the birth year that way, but many users are not aware…
Ollie C
  • 28,313
  • 34
  • 134
  • 217
1
2
3
52 53