Closed chrisonline closed 9 years ago
OK this is bad, I thought that maybe once it worked, it would at least be compatible in future Android versions... Well good you noticed it, I'll take a look at it when I get the time (though I'm quite busy these days). It might need an additional hack (first resetting the selection, then waiting and blocking that selection callback and then reselecting the temporary item)...
There is your fix, it turned out that in Android 5.1 they somehow group multiple spinner selection callbacks together, and only the last one will actually call the onItemSelected listener (which is actually a lot nicer!). That broke my temporary selection workaround because it was using a simple int counter, now it is way more robust ;).
As for your issue with the 12 hour mode not being set, I can't reproduce that on my N5. I called datePicker.setTimeFormat(new SimpleDateFormat("hh:mm a"));
directly after seting the listener in the sample's onCreate() method and it worked correctly. Can you point me to how exactly you're calling that method?
Edit lol ignore that I found your bug. It seems that the custom dateFormat somehow is saved permanently, I actually had to clear data from the sample app to get back to the default format. Will take a look at where the hack that is done...
Thanks for the quick fix!! Great! Will merge this into my code.
I will recheck the problem with the 12 hour mode.
OK good, I tried to check the 12 hour bug again and now I can't seem to reproduce it...
Forget the problem with 12 hours. This was my mistake. I thought this was with 5.1 but it was since my last update of the app.
Closing and thanks for your support.
On Android 5.1 it seems the "onItemSelected" is not fired after once selected. Have tried it with your sample app and there is the same problem.
How to reproduce on 5.1: 1) Select the time and select "Pick a time". 2) Select a time that is not a smart date time for example 13:15 3) You see the toast message "time selected ..." 4) Now tap again on the time spinner and select again "Pick a time". 5) Select a time different to a time of the last one 6) No toast message with the new time is appearing
Can you check this whats going on in "Android 5.1"!
Also a strange issue is that the 24 hour mode is not working in 5.1! It seems it takes always the setting from the system. On a 24 hour system if you set 12 hours you will still get 24 hours. The method "setTimeFormat is ignored in 5.1 !?!
I haven't found any changes to this in the offical docs from 5.1!