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
350
votes
32 answers

Datepicker: How to popup datepicker when click on edittext

I want to show datepicker popup window. I have found some examples but i am not getting it properly. I have one edittext and i want that when i click on edittext the datepicker dialog should popup and after setting the date, the date should show in…
Surabhi Pandey
  • 4,058
  • 4
  • 18
  • 25
148
votes
19 answers

Jelly Bean DatePickerDialog --- is there a way to cancel?

--- Note to moderators: Today (July 15), I've noticed that someone already faced this problem here. But I'm not sure if it's appropriate to close this as a duplicate, since i think I provided a much better explanation of the issue. I'm not sure if I…
davidcesarino
  • 16,160
  • 16
  • 68
  • 109
132
votes
13 answers

How set maximum date in datepicker dialog in android?

In my application am using date picker to set date.i want to set date picker maximum date is as today date according to system date.i don't know how to set date picker maximum date as today date.Can any one know help me to solve this problem. My…
Yugesh
  • 4,030
  • 9
  • 57
  • 97
77
votes
12 answers

How to Disable future dates in Android date picker

How to Disable future dates in Android date picker Java Code : mExpireDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // To show current date in the datepicker …
venu
  • 2,971
  • 6
  • 40
  • 59
74
votes
10 answers

How to change the style of a DatePicker in android?

I want to change the default color of the date/time picker dialog in Android, so that it should match my app's theme. I searched for the solution on Google, but I couldn't find a solution. What I was doing was creating a new style:
73
votes
11 answers

Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work

I want my DatePicker and the button to be invisible in the begining. And when I press my magic button I want to setVisibility(View.Visible); The problem here is when I setVisibility(View.GONE) or setVisibility(View.INVISIBLE) nothing changes and the…
nayden
  • 875
  • 2
  • 7
  • 10
70
votes
4 answers

How to show DatePickerDialog on Button click?

I'm developing an app that requires users to select dates (dd/mm/yyyy). I want to show a dialog box with DatePicker on button click. once date is selected it must show in EditText. I'm using Android Studio 2.2, the project with min sdk is 23. Kindly…
Pratik Pitale
  • 1,655
  • 1
  • 16
  • 30
63
votes
5 answers

Android - OnDateChangedListener - how do you set this?

There is an event listener in Android called DatePicker.OnDateChangedListener. I am trying to set a DatePicker view's on date changed listener as follows: DatePicker dp = new DatePicker(getContext()); dp.setOnDateChangedListener(this); //where…
Tawani
  • 11,067
  • 20
  • 82
  • 106
60
votes
11 answers

How to set minimum DatePicker date to current date

I want to set the minimum date the user can choose in a DatePicker to the current date. I've tried this: DatePicker datePicker = (DatePicker) findViewById(R.id.event_date); datePicker.setMinDate(System.currentTimeMillis()); That gives me the…
gsgx
  • 12,020
  • 25
  • 98
  • 149
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
54
votes
9 answers

Get date from datepicker using dialogfragment

I'm using the google example to insert a datepicker inside my app using a dialogfragment http://developer.android.com/guide/topics/ui/controls/pickers.html But I'm not sure how to get date after set it (not java expert). Dialog and datepicker runs…
Gonzalo Cao
  • 2,286
  • 1
  • 24
  • 20
46
votes
6 answers

Setting time and date to date picker and time picker in android

I am using a date picker and time picker in my application. I want to set the date and time when the page loads. Is this possible? How so?
andro-girl
  • 7,989
  • 22
  • 71
  • 94
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…
39
votes
3 answers

Calender.getInstance() gives error in Android Studio

I'm trying to pop-open a DatePicker dialogue box when my EditText is clicked. The problem is, when I try to instantiate my Calender object with Calender.getInstance() the creepy-red-underline appears below getInstance(). Calender myCalender =…
Arsal
  • 565
  • 2
  • 8
  • 17
35
votes
4 answers

Android spinner with date picker, like Google Calendar app

I'm trying to get a text box that looks like a spinner to activate a date picker dialog. This is done in both the Google Calendar app and the Contacts app (for birthdate) on ICS. Do I need to use a spinner, and if so how do I change it's input view…
1
2 3
52 53