List of usage examples for android.app DatePickerDialog getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.gnucash.android.ui.chart.ChartDatePickerFragment.java
/** * {@inheritDoc}//from w w w. j a v a 2 s .co m */ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { DatePickerDialog dialog = new DatePickerDialog(getActivity(), callback, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH)); try { Field datePickerField = dialog.getClass().getDeclaredField("mDatePicker"); datePickerField.setAccessible(true); DatePicker datePicker = (DatePicker) datePickerField.get(dialog); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { datePicker.setMinDate(minDate); datePicker.setMaxDate(maxDate); } for (Field field : datePicker.getClass().getDeclaredFields()) { if (field.getName().equals("mDaySpinner") || field.getName().equals("mDayPicker")) { field.setAccessible(true); ((View) field.get(datePicker)).setVisibility(View.GONE); } } } catch (Exception e) { Log.w(TAG, e.getMessage()); } return dialog; }