コード例 #1
0
  /** Configure nap duration pickers with correct ranges and default values */
  private void configurePickers() {
    mHourPicker = (NumberPicker) findViewById(R.id.nap_hour);
    mHourPicker.setRange(0, 23);
    mHourPicker.setCurrent(DEFAULT_NAP_HOURS);

    mMinutePicker = (NumberPicker) findViewById(R.id.nap_minute);
    mMinutePicker.setRange(0, 59);
    mMinutePicker.setCurrent(DEFAULT_NAP_MINUTES);
  }
コード例 #2
0
 /**
  * Computes the total nap duration
  *
  * @return the nap duration, in minutes
  */
 public int getNapDuration() {
   return mHourPicker.getCurrent() * 60 + mMinutePicker.getCurrent();
 }