本文整理汇总了Java中android.app.TimePickerDialog.updateTime方法的典型用法代码示例。如果您正苦于以下问题:Java TimePickerDialog.updateTime方法的具体用法?Java TimePickerDialog.updateTime怎么用?Java TimePickerDialog.updateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.TimePickerDialog
的用法示例。
在下文中一共展示了TimePickerDialog.updateTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateDialog
import android.app.TimePickerDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
TextView textView = new TextView(getActivity().getApplicationContext());
textView.setText("Set Time");
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20f);
textView.setPadding(20, 20, 20, 20);
final TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(), this, 0, 0, true);
timePickerDialog.setCustomTitle(textView);
String setting = getArguments().getString(SETTING);
if (isBlank(setting)) {
throw new IllegalArgumentException("Setting must be provided");
}
long time = Setting.getLong(getActivity().getApplicationContext(), setting);
time = time / 1000 / 60;
int hour = (int) time / 60;
int minute = (int) time % 60;
timePickerDialog.updateTime(hour, minute);
return timePickerDialog;
}
示例2: onCreateDialog
import android.app.TimePickerDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(), mTimeSetListener, calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE), false);
if (scheduledTimeHolder.getTimestamp() != null) {
String scheduledTime = scheduledTimeHolder.getTime();
String[] st = scheduledTime.split(":");
timePickerDialog.updateTime(Integer.parseInt(st[0]), Integer.parseInt(st[1]));
}
return timePickerDialog;
}
示例3: onCreateDialog
import android.app.TimePickerDialog; //导入方法依赖的package包/类
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
setupArguments(savedInstanceState);
final Calendar calendar = Calendar.getInstance();
TimePickerDialog timePickerDialog = new TimePickerDialog(getContext(), builder.getThemeResId(), this,
calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), builder.is24Hours());
if (builder.getCurrentHour() != -1 && builder.getCurrentMinute() != -1) {
timePickerDialog.updateTime(builder.getCurrentHour(), builder.getCurrentMinute());
}
return timePickerDialog;
}