1

I want a timepickerDialog in my application, that can increase minute by 15 and also I want to get value of selected AM/PM.

Please suggest...

Jaydeep Khamar
  • 5,975
  • 3
  • 32
  • 30
Parmendra Singh
  • 1,015
  • 3
  • 15
  • 27

1 Answers1

2

For the first issue, see this Stack Overflow post.

For the second, you should first set a listener:

OnTimeSetListener listener = new OnTimeSetListener() {
        public void onTimeSet(TimePicker arg0, int hour, int minute) {
            //whatever you want to do with hour and minute
        }
};

Then display the TimePickerDialog:

Calendar cal = Calendar.getInstance();
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
TimePickerDialog dialog = new TimePickerDialog(this, listener, hour, minute, true);
dialog.show();
Community
  • 1
  • 1
Gabriel Negut
  • 13,860
  • 4
  • 38
  • 45