Search code examples
androiddatepickermaterial-designtimepicker

Use spinner-based time picker on new Android app?


I'm developing an Android app which has target API for Android 6. As you may know, in Android 5 they introduced Material look and feel, and included the Calendar Date picker and Analog Clock time picker.

The Android 4 time pickers had individual spinners for Month/Day/Year and Hour/Minute/AM-PM. I think that they are quicker to use, especially the time picker.

How can I use those older date and time picker dialogs while still keeping the Android 5-6 overall look and feel for the other activities in the app?

I know that those older pickers are probably only kept for compatibility, but would still like to use them anyway. (I'm assuming that packaging them into the app would be more difficult.)

For reference, this is the code I am currently using.

import android.app.DatePickerDialog;
...
    new DatePickerDialog(this, callback, y, m, d).show();

Solution

  • How about setting theme as the 2nd parameter and onDateListener

    new DatePickerDialog(context, android.R.style.Theme_Holo_NoActionBar_Fullscreen,listener, y, m, d);