简体   繁体   中英

How to make timePicker in Android Studio 3

I am very beginner in android development and i need somebody help for this question. I want to make an Alarm Manager (Simple alarm timer, for start), and i need to make a time picker. So, i want to make material time picker and get information from it. Can someone help me with it?

Next time I suggest you search in google first, you can make a time picker dialog like this

final Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);

        // Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
              new TimePickerDialog.OnTimeSetListener() {
              @Override
              public void onTimeSet(TimePicker view, int hourOfDay,
                                          int minute) {
                    txtTime.setText(hourOfDay + ":" + minute);
                   }
              }, mHour, mMinute, false);
timePickerDialog.show();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM