SlideDateTimePicker icon indicating copy to clipboard operation
SlideDateTimePicker copied to clipboard

Changed calls to getTargetFragment() to getParentFragment() to solve crashes on rotation

Open irenenaya opened this issue 7 years ago • 3 comments

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.

irenenaya avatar Aug 10 '17 01:08 irenenaya

you are right,thank you

luyuan11233 avatar Dec 04 '19 06:12 luyuan11233

thanks for your help!

lunay0ung avatar Feb 25 '20 06:02 lunay0ung

Thank you soo much this worked for me.

Kwenziwa avatar Mar 14 '22 10:03 Kwenziwa