Questions tagged [datepickerdialog]

An Android dialog that displays a date picker. Because it's an extension of the AlertDialog, it also supports buttons.

318 questions
55
votes
7 answers

Set Limit on the DatePickerDialog in Android?

How to limit on DatePickerDialog to choose a date from 2-12 years in the past or from 0-2 years from the current date? I have DatePickerDialog in activity which is used for getting the date of birth for child and infant. Child age will be (2-12yrs)…
Developer
  • 6,292
  • 19
  • 55
  • 115
47
votes
7 answers

How to use DatePickerDialog in Kotlin?

In Java an DatePickerDialog can be use such as: final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); DatePickerDialog dpd = new…
Adil Saiyad
  • 1,582
  • 2
  • 17
  • 34
41
votes
2 answers

Android Material Design Inline Datepicker issue

I have a ScrollView with a Datepicker In the previous versions of Android the Datepicker is this: And I can scroll the single elements of Datepicker day, month, years without problems In Android Lollipop API level 21 Material, the Datepiker is…
23
votes
2 answers

Android - DatePickerDialog - Old APIs

I am trying to create a DatePickerDialog in my app in Android but when I create a DatePickerDialog I receive the following message: Call requires API level 24 (current min is 14): android.app.DatePickerDialog#DatePickerDialog How can I use a…
GuiDupas
  • 1,681
  • 2
  • 22
  • 44
17
votes
8 answers

DatePicker.setMinDate(long minDate) throws IllegalArgumentException: Time not between

I have a time interval consisting of a beginning and an end date. I have a way of letting the user set these dates through DatePickerDialogs. Here is the code of the method that creates and shows the dialogs: private void editInterval(boolean…
zbr
  • 6,860
  • 4
  • 31
  • 43
13
votes
4 answers

OnClickListener in TextInputEditText wrapped around TextInputLayout

I have got a TextInputEditText wrapped around a TextInputLayout, as Google recommends to do: https://developer.android.com/reference/android/support/design/widget/TextInputLayout.html However, my TextInputEditText has an OnClickListener set on it so…
13
votes
6 answers

Month name is appearing with M+number in datePicker dialog in android

I am trying to display date in datePicker dialog in a format like Sep|29|2016. you can see in following image. Expected output unfortunately most of the time i am getting 28|M09|2016 rarely i am getting expected output. you can see in following…
Sujay
  • 2,510
  • 2
  • 27
  • 47
13
votes
2 answers

DatePickerDialog display year picker first

I want my DatePickerDialog as soon as it opens to display the list of years. For example, when I show the dialog I see the calendar view: : If I tap on the text "1900" the year view is shown: I tried this code but it had no effect and I'm clueless…
Rodrigo Direito
  • 748
  • 6
  • 21
11
votes
2 answers

setSpinnersShown and setCalendarViewShown on DatePicker deprecated in API level 24

I tried to switch to calendar to spinner mode in DatePicker by changing setSpinnersShown and setCalendarViewShown value programmatically, but in API 24, Android Studio shows the deprecated warning. What is the alternative ways for me to set my…
Vinh Nguyen
  • 610
  • 7
  • 16
9
votes
4 answers

DatePickerDialog incorrectly enforcing a minimum date of Jan 1, 1970

We have a member reporting that he is unable to set a date before Jan 1, 1970 on our DatePickerDialog. This issue does not repro for us. I am already aware that the DatePickerDialog does not expose the setMinDate/setMaxDate functions of the…
esilver
  • 27,713
  • 23
  • 122
  • 168
9
votes
2 answers

android Fatal Exception: java.lang.NullPointerException when opening the DatePickerDialog

I have an EditText when clicked it should open DatePickerDialog. But in some devices it is crashing randomly. In Crashlytics it is showing it is crashing in some devices with android version 8 and some in version 9. Please let me know where i am…
Rajeev Shetty
  • 1,534
  • 1
  • 17
  • 27
9
votes
1 answer

datepicker dialog can't swich to spinner on Android 7.0 device

Before Android N, I can use the code below to instance a spnnier mode datepicker dialog: new DatePickerDialog(getContext(), AlertDialog.THEME_HOLO_LIGHT, null, 2016, 9, 18); but the above code is not work on Android N device, it always show the…
9
votes
3 answers

Android 6.0 DatePickerDialog Theme

Seems like anyone using Marshmallow (Android 6.0) is not able to use the DatePicketDialog within my app. There appears to be some sort of theme issue that I'm encountering. I use a DialogFragment which contains a DatePicketDialog for the user to…
Mike Walker
  • 2,944
  • 8
  • 30
  • 62
9
votes
1 answer

DatePickerDialog displays with two borders

I have a question about DatePickerDialog displaying. I want to create date picker dialog with "HoloDialog" theme like this: DatePickerDialog dpd = new DatePickerDialog(this, android.R.style.Theme_Holo_Dialog, reservationDate, 2014, 1, 1); Then I…
Ivan B
  • 394
  • 1
  • 5
  • 18
9
votes
2 answers

How do you get a DatePicker from a DatePickerDialog?

I have a activity that is popping up a android.app.DatePickerDialog. DatePickerDialog dialog = new DatePickerDialog(this, startDateSetListener, start_cal.get(Calendar.YEAR), start_cal.get(Calendar.MONTH), start_cal.get(Calendar.DATE)); I want to…
stacybro
  • 115
  • 1
  • 5
1
2 3
21 22