List of usage examples for android.widget DatePicker getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.gnucash.android.ui.chart.ChartDatePickerFragment.java
/** * {@inheritDoc}/*www.j a va2 s.c o 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; }
From source file:org.gots.ui.NewSeedActivity.java
private void monthFilter(DatePicker picker) { try {/*from w w w.j a v a2 s . c o m*/ Field f[] = picker.getClass().getDeclaredFields(); for (Field field : f) { if (field.getName().equals("mDaySpinner")) { field.setAccessible(true); Object dayPicker = new Object(); dayPicker = field.get(picker); ((View) dayPicker).setVisibility(View.GONE); } if (field.getName().equals("mYearSpinner")) { field.setAccessible(true); Object dayPicker = new Object(); dayPicker = field.get(picker); ((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()); } }