DatePicker crash in samsung with android 5.0

前端 未结 3 1791
有刺的猬
有刺的猬 2020-12-29 04:12

I am having trouble with creating a datepicker in samsung note 2 device with lollipop 5.0. The exception is:

java.util.IllegalFormatConversionException: %d c         


        
相关标签:
3条回答
  • 2020-12-29 04:47

    As alanv noticed, this is a bug of Samsung's Android 5 implementation.

    I set up a different theme which shows the date picker with the (older) spinners instead of the calendar view. In the code, I check if the app is running on a samsung device with lollipop and a language other then english, and if so, I apply the theme with the spinners. This works well and there are no other libraries or other hacks necessary.

    If needed I can add the theme and how to apply it to this answer.

    0 讨论(0)
  • 2020-12-29 04:52

    Forget about the built-in date picker. There's only one way to get rid of the crash: use a library that provides an independent implementation.

    For a date picker fragment: https://github.com/flavienlaurent/datetimepicker

    For a date picker widget: https://github.com/SingleCycleKing/CustomTimePicker (this is more a starting point than a ready-to-use-solution)

    0 讨论(0)
  • 2020-12-29 04:54

    As Ridcully says, its an issue with Samsung's 5.0 implementation

    Workaround suggestions can be found here. Unfortunately none are the most pretty.

    DatePicker crashes on my device when clicked (with personal app)

    0 讨论(0)
提交回复
热议问题