List of usage examples for android.widget TimePicker findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:edu.pdx.its.portal.routelandia.DatePickUp.java
/** * change the minute interval to quarter* * @param timePicker : timepicker obk in the view *//*from w w w .ja v a 2 s. c o m*/ @SuppressLint("NewApi") private void setTimePickerInterval(TimePicker timePicker) { try { Class<?> classForid = Class.forName("com.android.internal.R$id"); Field field = classForid.getField("minute"); NumberPicker minutePicker = (NumberPicker) timePicker.findViewById(field.getInt(null)); minutePicker.setMinValue(0); minutePicker.setMaxValue(7); ArrayList<String> displayedValues = new ArrayList<>(); for (int i = 0; i < 60; i += TIME_PICKER_INTERVAL) { displayedValues.add(String.format("%02d", i)); } for (int i = 0; i < 60; i += TIME_PICKER_INTERVAL) { displayedValues.add(String.format("%02d", i)); } minutePicker.setDisplayedValues(displayedValues.toArray(new String[0])); } catch (Exception e) { e.printStackTrace(); } }