android.widget.TimePicker.getCurrentMinute()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中android.widget.TimePicker.getCurrentMinute()方法的一些代码示例,展示了TimePicker.getCurrentMinute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimePicker.getCurrentMinute()方法的具体详情如下:
包路径:android.widget.TimePicker
类名称:TimePicker
方法名:getCurrentMinute

TimePicker.getCurrentMinute介绍

暂无

代码示例

代码示例来源:origin: ankidroid/Anki-Android

@Override
@SuppressWarnings("deprecation")
public int getMinute(TimePicker picker) { return picker.getCurrentMinute(); }

代码示例来源:origin: square/assertj-android

public TimePickerAssert hasCurrentMinute(Integer minute) {
 isNotNull();
 Integer actualMinute = actual.getCurrentMinute();
 assertThat(actualMinute) //
   .overridingErrorMessage("Expected current minute <%s> but was <%s>.", minute,
     actualMinute) //
   .isEqualTo(minute);
 return this;
}

代码示例来源:origin: stackoverflow.com

final View dialogView = View.inflate(activity, R.layout.date_time_picker, null);
final AlertDialog alertDialog = new AlertDialog.Builder(activity).create();

dialogView.findViewById(R.id.date_time_set).setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {

     DatePicker datePicker = (DatePicker) dialogView.findViewById(R.id.date_picker);
     TimePicker timePicker = (TimePicker) dialogView.findViewById(R.id.time_picker);

     Calendar calendar = new GregorianCalendar(datePicker.getYear(),
              datePicker.getMonth(),
              datePicker.getDayOfMonth(),
              timePicker.getCurrentHour(),
              timePicker.getCurrentMinute());

     time = calendar.getTimeInMillis();
     alertDialog.dismiss();
  }});
alertDialog.setView(dialogView);
alertDialog.show();

代码示例来源:origin: stackoverflow.com

calendar.set(Calendar.MINUTE, picker.getCurrentMinute());

代码示例来源:origin: stackoverflow.com

lastMinute=picker.getCurrentMinute();

代码示例来源:origin: stackoverflow.com

if (mTimeSetListener != null) {
  mTimeSetListener.onTimeSet(mTimePicker, mTimePicker.getCurrentHour(),
      mTimePicker.getCurrentMinute() * TIME_PICKER_INTERVAL);

代码示例来源:origin: facebook/facebook-android-sdk

TimePicker picker = (TimePicker) view;
  int h = picker.getCurrentHour();
  int m = picker.getCurrentMinute();
  textObj = String.format("%02d:%02d", h, m);
} else if (view instanceof RadioGroup) {

代码示例来源:origin: stackoverflow.com

TimePicker t = new TimePicker(this);

String formattedTime = "";
int hour = t.getCurrentHour();
String sHour = "00";
if(hour < 10){
 sHour = "0"+hour;
} else {
 sHour = String.valueOf(hour);
}

int minute = t.getCurrentMinute();
String sMinute = "00";
if(minute < 10){
 sMinute = "0"+minute;
} else {
 sMinute = String.valueOf(minute);
}

formattedTime = sHour+":"+sMinute+":"+"00"; // Sorry you can't get seconds from a TimePicker

代码示例来源:origin: stackoverflow.com

final TimePicker timePicker = new TimePicker(this);
 timePicker.setIs24HourView(true);
 timePicker.setCurrentHour(20);
 timePicker.setCurrentMinute(15);
 new AlertDialog.Builder(this)
     .setTitle("Test")
     .setPositiveButton(android.R.string.ok, new OnClickListener() {
       @Override
       public void onClick(DialogInterface dialog, int which) {
         Log.d("Picker", timePicker.getCurrentHour() + ":"
             + timePicker.getCurrentMinute());
       }
     })
     .setNegativeButton(android.R.string.cancel,
         new OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog,
               int which) {
             Log.d("Picker", "Cancelled!");
           }
         }).setView(timePicker).show();

代码示例来源:origin: stackoverflow.com

mTimePicker.clearFocus();
mCallback.onTimeSet(mTimePicker, mTimePicker.getCurrentHour(),
    mTimePicker.getCurrentMinute()*increment);

代码示例来源:origin: stackoverflow.com

final   DatePicker dp = (DatePicker) findViewById(R.id.datePicker);
   final   TimePicker tp = (TimePicker) findViewById(R.id.timePicker);
   btnSet.setOnClickListener(new OnClickListener() {
     @Override
     public void onClick(View v) {
       String strDateTime = dp.getYear() + "-" + (dp.getMonth() + 1) + "-" + dp.getDayOfMonth() + " "+ tp.getCurrentHour() + ":" + tp.getCurrentMinute();
       Toast.makeText(TimeDate.this, "User selected " + strDateTime + "Time", Toast.LENGTH_LONG).show(); //Generate a toast only if you want 
       finish();   // If you want to continue on that TimeDateActivity
        // If you want to go to new activity that code you can also write here
     }});

代码示例来源:origin: stackoverflow.com

TimePicker timeStart;
TimePicker timeEnd;

int calcDifTime() {
    int difHour = timeEnd.getCurrentHour() - timeStart.getCurrentHour();
    int difMin = timeEnd.getCurrentMinute() - timeStart.getCurrentMinute();

    return difHour * 60 + difMin;
  }

代码示例来源:origin: com.squareup.assertj/assertj-android

public TimePickerAssert hasCurrentMinute(Integer minute) {
 isNotNull();
 Integer actualMinute = actual.getCurrentMinute();
 assertThat(actualMinute) //
   .overridingErrorMessage("Expected current minute <%s> but was <%s>.", minute,
     actualMinute) //
   .isEqualTo(minute);
 return this;
}

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
  super.onSaveInstanceState(savedInstanceState);
  //TimePicker state needs to be saved manually because of this bug in Android that affects at least ICS: http://code.google.com/p/android/issues/detail?id=22754
  savedInstanceState
      .putInt(OTPApp.BUNDLE_KEY_TIMEPICKER_SAVED_HOUR, pickerTime.getCurrentHour());
  savedInstanceState
      .putInt(OTPApp.BUNDLE_KEY_TIMEPICKER_SAVED_MINUTE, pickerTime.getCurrentMinute());
}

代码示例来源:origin: renyuneyun/Easer

private static Calendar fromTimePicker(TimePicker timePicker) {
  Calendar calendar = Calendar.getInstance();
  if (Build.VERSION.SDK_INT >= 23) {
    calendar.set(Calendar.HOUR_OF_DAY, timePicker.getHour());
    calendar.set(Calendar.MINUTE, timePicker.getMinute());
  } else {
    calendar.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour());
    calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute());
  }
  return calendar;
}

代码示例来源:origin: renyuneyun/Easer

private static Calendar fromTimePicker(TimePicker timePicker) {
  Calendar calendar = Calendar.getInstance();
  if (Build.VERSION.SDK_INT >= 23) {
    calendar.set(Calendar.HOUR_OF_DAY, timePicker.getHour());
    calendar.set(Calendar.MINUTE, timePicker.getMinute());
  } else {
    calendar.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour());
    calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute());
  }
  return calendar;
}

代码示例来源:origin: termux/termux-api

@Override
String getResult() {
  String result;
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
    result = String.format(Locale.getDefault(), "%02d:%02d", widgetView.getHour(), widgetView.getMinute());
  } else {
    result = String.format(Locale.getDefault(), "%02d:%02d", widgetView.getCurrentHour(), widgetView.getCurrentMinute());
  }
  return result;
}

代码示例来源:origin: oliexdev/openScale

@Override
protected void onDialogClosed(boolean positiveResult) {
  super.onDialogClosed(positiveResult);
  if (positiveResult) {
    calendar.set(Calendar.HOUR_OF_DAY, picker.getCurrentHour());
    calendar.set(Calendar.MINUTE, picker.getCurrentMinute());
    setSummary(getSummary());
    if (callChangeListener(calendar.getTimeInMillis())) {
      persistLong(calendar.getTimeInMillis());
      notifyChanged();
    }
  }
}

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

@Override
  public void onClick(View v) {
    Calendar cal = Calendar.getInstance();
    cal.set(pickerDate.getYear(), pickerDate.getMonth(), pickerDate.getDayOfMonth(),
        pickerTime.getCurrentHour(), pickerTime.getCurrentMinute());
    ArriveBySpinnerItem selectedSscheduleType = (ArriveBySpinnerItem) spinScheduleType
        .getSelectedItem();
    ((MyActivity) getActivity())
        .onDateComplete(cal.getTime(), selectedSscheduleType.getValue());
    dismiss();
  }
};

代码示例来源:origin: daliyan/MyKeep

private void setDateTime(){
  if(mOnTimeSetListener!=null && mDatePicker!=null && mTimePicker!=null){
    mOnTimeSetListener.onDateTimeSet(mDatePicker.getYear(),mDatePicker.getMonth(),mDatePicker.getDayOfMonth(),
        mTimePicker.getCurrentHour(),mTimePicker.getCurrentMinute());
  }
  this.dismiss();
}

相关文章