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
8
votes
2 answers

How to disable certain dates in the Android Date Picker dialog?

I am using default Android DatePickerDialog which contains android.widget.DatePicker. Does anybody know how to disable or make certain dates unselectable? I know DatePicker allows to setMinDate() and setMaxDate() but it doesn't allow to disable…
Alex Wih
  • 1,015
  • 2
  • 11
  • 24
8
votes
4 answers

Impossible to make my DatePickerDialog use a spinner style programmatically

I'm using a DialogFragment to open a DatePickerDialog public class DatePickerFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker …
8
votes
2 answers

How to prevent select passed date in DatePickerDialog (setMinDate not work as expected)

I found DatePicker(Dialog) very confusing... When setMinDate() is set... the shown calendar really "visually disable" passed dates (make them gray) but these dates are still posible to select! I want to user prevent to do so. Ideal way would be…
8
votes
4 answers

NullPointerException when using DatePicker setMaxDate() in a DatePickerDialog

I am using a DatePickerDialog, and I am trying to set the minimum and maximum dates such that the user can only select a date within the previous 24 hours or next 24 hours. Here is the code. (Note that it only tries to set the min/max range if…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
7
votes
5 answers

Change DatePicker header text color

I have a datepicker that's showing a header on Lollipop, it looks like this I want to either change the color of the big date in the header from black to white, or remove the header altogether, I don't care which. I've tried changing…
TimSim
  • 3,936
  • 7
  • 46
  • 83
6
votes
3 answers

How to use DatePickerDialog in BaseAdapter

I am working with the BaseAdapter Class. I want to Display DatePickerDialog in it. When I use showDialog(DATE_DIALOG_ID); I am getting error. Please guide me regarding this. package com.OrganisemeePhone.adapter; import java.util.ArrayList; import…
Android
  • 2,383
  • 1
  • 26
  • 44
6
votes
2 answers

How to set Android DatePicker mode to spinner for APIs below level 21

I want to display a DatePickerDialog with mode spinner instead of calendar. In my styles.xml, I tried to put this attribute but it says that the minimum SDK version I should be using is API 21. spinner I…
racumin
  • 392
  • 2
  • 3
  • 17
6
votes
2 answers

Using Kit Kat DatePicker in Lollipop Device

I'm trying to show a DatePickerDialog in my apps. But I realized that the DatePickerDialog that show up depends on the phone OS. My question is how can I show KitKat style DatePicker in Lollipop OS? I know this is possible because some apps like…
6
votes
2 answers

Android DatePicker/Dialog displaying incorrect month/s using min/max date

I'm using the DatePickerDialog and the DatePicker to set a specific range. datePicker.setMinDate(minDate); datePicker.setMaxDate(maxDate); If my min/max - dates are in the range of one month (eg.: 7.2.2014 - 27.2.2014), i still get the neighbour…
Maxi
  • 979
  • 10
  • 16
6
votes
4 answers

How to use OnDateChangedListener, OnDateSetListener without using DatePickerDialog?

I want to be able to detect changes on datepicker as soon as user starts to change it. However, I don't want to use datrpickerdialog. Does anyone know why the onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) doesn't fire when I change the…
Zardaloop
  • 1,594
  • 5
  • 22
  • 43
5
votes
2 answers

Select multiple dates in Android DatePickerDialog

I've got a requirement to select multiple dates from Android DatePickerDialog. Below is my snippet. With this, I'm able to select only one date. I've seen other libraries like https://github.com/square/android-times-square. But, I'm more interested…
Sravan Patti
  • 61
  • 1
  • 4
  • 6
5
votes
0 answers

Android: datepickerdialog header doesn't look like it should

I'm creating a datepickerdialog like this: Calendar newCalendar = Calendar.getInstance(); myDatePicker = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int…
Jon
  • 7,941
  • 9
  • 53
  • 105
5
votes
2 answers

Android: Change button text in DatePickerDialog / TimePickerDialog

I have got a DatePickerDialog. In the default configuration it works fine. DatePickerDialog dialog = new DatePickerDialog( view.getContext(), new OnDateSetListener() { @Override public void onDateSet(DatePicker picker, int…
mburm
  • 1,417
  • 2
  • 17
  • 37
4
votes
1 answer

Stopping the DatePickerDialog from closing when use clicks the Set button

I've implemented a DatePickerDialog using the example shown here. In my implementation of the DatePickerDialog.OnDateSetListener I added validation logic to check that the selected date is within specific range. private final…
Camsoft
  • 11,718
  • 19
  • 83
  • 120
4
votes
2 answers

Displaying DatePickerDialog in a Fragment

I am creating a fragment that have a EditText that when I clicked it, there will be a DatePickerDialog showing up.. but my app is crashing whenever I click the EditText.. The Error is in this line: return new DatePickerDialog(getActivity(),…
Richard Johnson
  • 309
  • 4
  • 17
1
2
3
21 22