SlideDateTimePicker
SlideDateTimePicker copied to clipboard
Changed calls to getTargetFragment() to getParentFragment() to solve crashes on rotation
The app would crash on rotation or backgrounding. That is due to the target fragment not being found when the hosting fragment is recreated. According to the discussions here: https://issuetracker.google.com/issues/36969568 and in many other places, the issue mainly is caused by the calls to setTargetFragment() and getTargetFragment(). The SlideDateTimeDialogFragment class calls for the ChildFragmentManager (as opposed to a FragmentManager) when instantiating the ViewPagerAdapter. Therefore, the DateFragment and TimeFragment should have the Dialog as parent. The issue is solved by changing the calls to getTargetFragment() in the callbacks from TimeFragment and DateFragment to be calls to getParentFragment(), and by removing the calls to setTargetFragment() in the getItem() method of the SlideDateTimeDialogFragment class.
you are right,thank you
thanks for your help!
Thank you soo much this worked for me.