Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Last active December 23, 2023 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/687ca406d46dc914b70c566c1247d9f9 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/687ca406d46dc914b70c566c1247d9f9 to your computer and use it in GitHub Desktop.
How to Create Dialog Series Timepicker - Java
public class MyDialogFragment extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
// デフォルトの時刻を用意
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
return new TimePickerDialog(requireContext(), null, hour, minute, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment