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...
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...
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();