I have a time picker function which sets time in an EditText . But the format it shows is not suitable. for example for 04:07pm is shown as 4:7. whenever the digit in time is l
TimePickerDialog tpd = new TimePickerDialog(YourActivity.this, new
TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
if (hourOfDay == 0) {
hourOfDay = 12;
}
mEndTime = (String.format("%02d:%02d", hourOfDay, minute));
//mEndTime = (hourOfDay + ":" + minute);
mEditTextEnd.setText(mEndDate + " " + mEndTime + ":00");
}
}, mHourEnd, mMinuteEnd, true);
tpd.show();