Closed AtaerCaner closed 5 years ago
This looks like a bug. I'll look into it.
Hi guys, I was having the same problem, did a quick look into it. Looks like getMostVisibleMonth()
is returning null in some scenarios, probably only before view layout.
Not sure what is the correct fix, but to keep my app from crashing I did the small fix referenced above, in my fork. Probably some other errors may still appear, because getMostVisiblePosition()
(at DayPickerView:259) also uses getMostVisibleMonth()
and I think it does not expect null as well.
Hope it helps somehow.
Upvote this as I'm having the same issue.
The fix @ricardorover applied will work, but it is sort of a symptom patch, rather than a root cause fix.
I've already spent a few hours hunting for the actual problem and made some progress, but it's not done yet. I should have some time in the next week to look at this more.
Thank's a lot,@ricardorover
Yes, thanks @ricardorover , but any update here @wdullaer ? Would be great to remain using your maven release version.
I have pushed some code that should resolve this. (I can no longer reproduce it locally)
The core of the issue was that I was trying to measure a View because it was fully drawn. Reshuffling some code ensures that it should be visible now before the code trying to measure it gets called.
It would be great if one or two of the people affected can try the current master branch and confirm that the issue is indeed resolved, before I publish this as a new release.
Looks nice @wdullaer. I did a little bit of tests on Android 8.1 and Android 4.1 (devices), and on Android 9 (emulator), the crash did not happen in my test using master branch (commit 0c31fd1).
Thanks for the fix, and thanks for the useful lib.
Working for me as well.
To build the release version of the .aar from master I had to remove two lines from layout/mdtp_date_time_picker_dialog.xml (is it used?)
layout_scrollPages from TabLayout
and the scrollBehaviour string from the ViewPager
That's a git mistake from a feature branch I tried a while ago. I'll remove that.
Thanks for reporting your feedback!
I'll release this shortly
It is working. Thank you
Hey, I'm using
com.wdullaer:materialdatetimepicker:4.1.0
and when I try to show year picker first withshowYearPickerFirst(true)
it throws exception as;My code is;
It works without
showYearPickerFirst(true)
.Thank you.