Use the Raval code. But to run it under Android version 11, follow these steps:
int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= 11) { try { Method m = datePicker.getClass().getMethod("setCalendarViewShown", boolean.class); m.invoke(datePicker, false); } catch (Exception e) {}
Now you are working on all versions of Android (above API> 3)
source share