-
-
Save codeforfun-jp/677bbc59891c4bfd696ecfe9a68fd8a9 to your computer and use it in GitHub Desktop.
How to Create Dialog Series Datepicker - Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyDialogFragment extends DialogFragment { | |
@NonNull | |
@Override | |
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { | |
// デフォルトの日付を用意 | |
final Calendar c = Calendar.getInstance(); | |
int year = c.get(Calendar.YEAR); | |
int month = c.get(Calendar.MONTH); | |
int day = c.get(Calendar.DAY_OF_MONTH); | |
return new DatePickerDialog(requireContext(), null, year, month, day); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment