I am new to android ,In my app I have a timepicker here I need to programmatically set the hour,minute,AM/PM values .
The value of the time is "11:11:AM" ,In this I have set the hour and time and it is working fine .but I don't know how to set the AM/PM values .
code:
if (!(mTime == null)) {
String timme = mTime;
String[] time = timme.split(":");
int hour = Integer.parseInt(time[0].trim());
int min = Integer.parseInt(time[1].trim());
String amPm = ((time[2].trim()));
mTimePicker.setIs24HourView(false);
mTimePicker.setHour(hour);
mTimePicker.setMinute(min);
}
Image:
It always shows "AM" even if the string has "PM". Can anyone help me to fix this .