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

Android: DatePicker and DatePicker Dialog

I have this code here on the options menu Dialog dialog = new Dialog(ScheduleActivity.this); dialog.setTitle("Add Event"); dialog.setContentView(R.layout.add_even_on); Button datePicker = (Button) dialog.findViewById(R.id.datePicker); final…
lemoncodes
  • 2,371
  • 11
  • 40
  • 66
10
votes
8 answers

Android - Hide date field in datepickerdialog

How to hide/remove date field in datepickerdialog. Actually my requirement is to use the native date picker dialog but it shows up with day, month, and year. But as per my requirement i need only month and year. So i want to hide or remove the day…
Ishu
  • 5,357
  • 4
  • 16
  • 17
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
4 answers

Change DatePickerDialog buttons to text

Hi i want to adjust my DatePickerDialog, and instead of buttons at the bottom (displayed on image below) i just want to make blue text. Here is how i created DatePickerDialog private val birthdayDate by lazy { Calendar.getInstance() } private…
Szuler
  • 379
  • 4
  • 18
9
votes
3 answers

Restrict Range in Android DatePicker Custom Dialog

I have a custom linear layout which has DatePicker and TimePicker widgets in it. This is used as DateTime picker. I want to restrict the DatePicker by way of setMaxDate() and setMinDate(). I have done: dp.setMaxDate(new…
9
votes
4 answers

How to set the limit on date in Date picker dialog

I want to put the limit on date so that user can not pick date more then that, for example if today is 1 January then User should not be able to select more then 7 dates , I mean he can not select 9 January. I also want him not to select the month…
stacy queen
  • 280
  • 1
  • 4
  • 19
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
3 answers

How do you set min and max dates in an Android DatePicker?

I am using Android's default date picker and my min supported SDK is 10 and I want to set the min and the max dates of the date picker. Here is what I have in my MainActivity class after the onCreate method: private void registerButtonListeners()…
denza
  • 1,298
  • 4
  • 24
  • 49
9
votes
2 answers

Initialize date in android datepicker to a specific date, that is not the current date.

In my app I have a date saved in a remote database that I want the date picker to be set to. I've researched and only found examples of setting the datepicker today's date via Calender java util. Example: final Calendar c = Calendar.getInstance(); …
Leoa
  • 1,167
  • 2
  • 14
  • 31
8
votes
1 answer

Change date-picker text color in spinner mode in android?

I have tried using custom style but it is not working , its default color is greyish and I want it to be white colored, can anyone help me out? TIA XML
Chirag Gupta
  • 469
  • 1
  • 7
  • 16
8
votes
4 answers

Disable Sundays and any other Specific Date

I want disable sundays and specific dates in particular months in android date picker The Datepicker I used is android datepicker: Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH,…
aenugula karthik
  • 339
  • 5
  • 19
8
votes
7 answers

How to Change the Datepicker style for Android

I'm currently making a registration form, and one of the fields is for the users Date of Birth. I want to use datepicker, however I don't want the calendar layout as shown below: I want the layout to look something like this so that way its…
JulianMartinez23
  • 81
  • 1
  • 1
  • 6
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…