Currently I am using date picker native one but i want to change it in such a way that i only needed month and year how to modify this my code is following
This worked for me after trying out several different approaches.
datePicker = (DatePicker) findViewById(R.id.date_picker);
public void hideDay() {
try {
java.lang.reflect.Field[] f = datePicker.getClass().getDeclaredFields();
for (java.lang.reflect.Field field : f) {
if (field.getName().equals("mDayPicker") || field.getName().equals("mDaySpinner")) {
field.setAccessible(true);
Object dmPicker = new Object();
dmPicker = field.get(datePicker);
((View) dmPicker).setVisibility(View.GONE);
}
}
}
catch (SecurityException e) {
TLog.d("ERROR", e.getMessage());
}
catch (IllegalArgumentException e) {
TLog.d("ERROR", e.getMessage());
}
catch (IllegalAccessException e) {
TLog.d("ERROR", e.getMessage());
}
}