[Solved] java.lang.NumberFormatException: Invalid int: “24 pm” [closed]


You can do the following :

if (time != null && !time.equals("")) {
    StringTokenizer st = new StringTokenizer(time, ":");
    String timeHour = st.nextToken();
    String timeMinute = st.nextToken();

    timePickDialog = new TimePickerDialog(v.getContext(),
        new TimePickHandler(), Integer.parseInt(timeHour),
        Integer.parseInt(timeMinute.replace(" am","").replace(" pm","")), true);
}

to replace both ” am” and ” pm” with “”.

5

solved java.lang.NumberFormatException: Invalid int: “24 pm” [closed]