I need hide the day field from a datepicker, I found this method, but the problems is in the version of Android 2.3.3, works fine, but in the version 4x of android not hides the day field. I guess is the library "java.lang.reflect.Field" is obsolete , but I'm not sure of this.
I found this solution here
may be going on here?
final DatePicker datePicker = new DatePicker(this);
LLayout.addView(datePicker);
hideDayField(datePicker, "mDayPicker");
private void hideDayField(DatePicker datePicker, String name) {
try {
java.lang.reflect.Field field = DatePicker.class.getDeclaredField(name);
field.setAccessible(true);
View fieldInstance = (View) field.get(datePicker);
fieldInstance.setVisibility(View.GONE);
} catch (Exception e) {
e.printStackTrace();
}
}