1

I am using the same method for my time picker as I am for my date picker. My date is working perfecty fine, but the time dialog keeps showing me an error. I have looked into similar issues, but nobody has been in a relatable situation.

This is the code for the time picker dialog:

timePickerDialog = new TimePickerDialog(AddReminderActivity.this,
                        new TimePickerDialog.OnTimeSetListener() {
                            @Override
                            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                                Calendar calendar = Calendar.getInstance();
                                calendar.set(hourOfDay, minute);
                                SimpleDateFormat format = new SimpleDateFormat("hh:mm a");
                                String timeString = format.format(calendar.getTime());
                                r_time.setText((timeString));

                            }
                        }, mHour, mMinute);
                timePickerDialog.show();

Here is also the error I keep getting:

Cannot resolve constructor 'TimePickerDialog(json.google_services.newreminderapp.AddReminderActivity, anonymous android.app.TimePickerDialog.OnTimeSetListener, int, int)'

Thank you.

ItsMeElvis
  • 21
  • 5

1 Answers1

3

After mMinute add true or false as another parameter. True - if you want 24 hour time, false if you want 12 hour time

codeinprogress
  • 3,193
  • 7
  • 43
  • 69