本文整理匯總了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;
}