i want to disable the day selection option on the android sdk date picker. any easy xml configuration would be the best
It possible to hack the DatePicker instance using reflection. This way, you are able to access the NumberPicker instance which represent the day in the DatePicker:
datePicker = (DatePicker) findViewById(R.id.expiration_date);
try {
Field f[] = datePicker.getClass().getDeclaredFields();
for (Field field : f) {
if (field.getName().equals("mDayPicker")) {
field.setAccessible(true);
Object dayPicker = new Object();
dayPicker = field.get(datePicker);
((View) dayPicker).setVisibility(View.GONE);
}
}
} catch (SecurityException e) {
Log.d("ERROR", e.getMessage());
}
catch (IllegalArgumentException e) {
Log.d("ERROR", e.getMessage());
} catch (IllegalAccessException e) {
Log.d("ERROR", e.getMessage());
}