本文整理了Java中android.widget.TimePicker.getHour()
方法的一些代码示例,展示了TimePicker.getHour()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimePicker.getHour()
方法的具体详情如下:
包路径:android.widget.TimePicker
类名称:TimePicker
方法名:getHour
暂无
代码示例来源:origin: ankidroid/Anki-Android
@Override
public int getHour(TimePicker picker) { return picker.getHour(); }
代码示例来源:origin: square/assertj-android
@TargetApi(M)
public TimePickerAssert hasHour(@IntRange(from = 0, to = 23) int hour) {
isNotNull();
int actualHour = actual.getHour();
assertThat(actualHour) //
.overridingErrorMessage("Expected hour <%s> but was <%s>.", hour,
actualHour) //
.isEqualTo(hour);
return this;
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
protected int getHour(TimePicker timePicker) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return timePicker.getHour();
} else {
return timePicker.getCurrentHour();
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
@TargetApi(M)
public TimePickerAssert hasHour(@IntRange(from = 0, to = 23) int hour) {
isNotNull();
int actualHour = actual.getHour();
assertThat(actualHour) //
.overridingErrorMessage("Expected hour <%s> but was <%s>.", hour,
actualHour) //
.isEqualTo(hour);
return this;
}
代码示例来源: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: annathehybrid/Github
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onClick(View v) {
calendar.set(Calendar.HOUR_OF_DAY, alarmTimePicker.getHour());
calendar.set(Calendar.MINUTE, alarmTimePicker.getMinute());
final int hour = alarmTimePicker.getHour();
final int minute = alarmTimePicker.getMinute();;
String minute_string = String.valueOf(minute);
String hour_string = String.valueOf(hour);
if (minute < 10) {
minute_string = "0" + String.valueOf(minute);
}
if (hour > 12) {
hour_string = String.valueOf(hour - 12) ;
}
myIntent.putExtra("extra", "yes");
myIntent.putExtra("quote id", String.valueOf(richard_quote));
pending_intent = PendingIntent.getBroadcast(MainActivity.this, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pending_intent);
setAlarmText("Alarm set to " + hour_string + ":" + minute_string);
}
代码示例来源:origin: zendesk/sdk_demo_app_android
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_time);
bindViews();
ok.setOnClickListener(v -> {
calendar = new GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
calendar.set(0, 0, 0, timePicker.getHour(), timePicker.getMinute());
} else {
calendar.set(0, 0, 0, timePicker.getCurrentHour(), timePicker.getCurrentMinute());
}
Intent intent = new Intent();
intent.putExtra(TIME_REQUEST_CODE, calendar);
setResult(RESULT_OK, intent);
finish();
});
cancel.setOnClickListener(v -> {
setResult(RESULT_CANCELED);
finish();
});
}
代码示例来源:origin: stackoverflow.com
lastMinute = picker.getCurrentMinute();
} else {
lastHour = picker.getHour();
lastMinute = picker.getMinute();
代码示例来源:origin: proninyaroslav/libretorrent
int minutes;
if (Build.VERSION.SDK_INT >= 23) {
hours = mTimePicker.getHour();
minutes = mTimePicker.getMinute();
} else {
代码示例来源:origin: jakobulbrich/preferences-demo
int minutes;
if (Build.VERSION.SDK_INT >= 23) {
hours = mTimePicker.getHour();
minutes = mTimePicker.getMinute();
} else {
内容来源于网络,如有侵权,请联系作者删除!