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
First need to create one function that check your input and convert it in String as per condition.
public String pad(int input) {
if (input >= 10) {
return String.valueOf(input);
} else {
return "0" + String.valueOf(input);
}
}
Then you can call like this
txtTime1.setText(pad(hourOfDay) + ":" + pad(minute));