I have an application, which was running perfectly on emulator 2.2 and real device 2.2.2. I decided to update my android version on phone from 2.2.2 do 2.3.4. Everything went fine, but my application suddenly stopped working without any reason. Well, it gets me Unparseable date exception on this line:
String timeOld12Hour = "11:50pm";// for example
Date time = new SimpleDateFormat("hh:mma").parse(timeOld12Hour);
Thats really funny, because i can’t see any error on this line. SImpledateformatter is exactly same format as my date. Whats most strange:
- it works fine emulator 2.2
- it works fine emulator 2.3.3
- it works fine every pc with java i tried today
- it worked fine on device 2.2.2
- it doesnt work on device 2.3.4
Where can be problem? I tried few phone restarts, uninstall application, reinstall application, i simple can’t get it working…
well, i found what was the problem. If add
Locale.UStoSimpleDateFormatconstructor, like this:everything goes fine. Thats really funny, I have never heard about something like this 😉 I must read something more about locales, because it looks its very important. Also still can’t understand why locale of my phone changed after Android upgrade…