Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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: calendar_view:

If I tap on the text "1900" the year view is shown: year_view

I tried this code but it had no effect and I'm clueless for what I could do: DatePickerDialog birthDatePicker = new DatePickerDialog(getActivity(), this, 0, 0, 0); birthDatePicker.getDatePicker().setSpinnersShown(true); birthDatePicker.show();

like image 834
Rodrigo Direito Avatar asked Jul 01 '15 19:07

Rodrigo Direito


1 Answers

Same as Show year selection first in Android Calendar View

I will copy here my answer:

You can get a reference to year view and then just simulate user click to open it.

dataPicker.getTouchables().get( 0 ).performClick();
like image 152
Matej Vukosav Avatar answered Oct 01 '22 05:10

Matej Vukosav