Closed AlbuYN closed 7 months ago
Hi. It's better to user a little bit different code
private val viewBinding by viewBinding(OnboardingFragmentBinding::bind,
onViewDestroyed = { binding: OnboardingFragmentBinding ->
// reset view
})
P.S. Sorry for so late answer (
Hi! Sometimes such an error shoots:
The version on which it appears: 1.5.9
Fatal Exception: java.lang.IllegalStateException: Fragment's view can't be accessed. Fragment isn't added at by.kirich1409.viewbindingdelegate.LifecycleViewBindingProperty.getValue(ViewBindingProperty.kt:87) at by.kirich1409.viewbindingdelegate.FragmentViewBindingProperty.getValue(FragmentViewBindings.kt:63) at by.kirich1409.viewbindingdelegate.FragmentViewBindingProperty.getLifecycleOwner(FragmentViewBindings.kt:52) at by.kirich1409.viewbindingdelegate.FragmentViewBindingProperty.getValue(FragmentViewBindings.kt:52) at ru.tander.magnit.loyalty.presentation.onboarding.OnboardingFragment.(OnboardingFragment.kt:37)
at ru.tander.magnit.loyalty.presentation.onboarding.OnboardingFragment.getBinding(OnboardingFragment.kt:37)
at ru.tander.magnit.loyalty.presentation.onboarding.OnboardingFragment.onDestroyView(OnboardingFragment.kt:74)
at androidx.fragment.app.Fragment.performDestroyView(Fragment.java:3346)
at androidx.fragment.app.FragmentStateManager.destroyFragmentView(FragmentStateManager.java:745)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:327)
at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:771)
at androidx.fragment.app.SpecialEffectsController$Operation.completeSpecialEffect(SpecialEffectsController.java:690)
at androidx.fragment.app.DefaultSpecialEffectsController$SpecialEffectsInfo.completeSpecialEffect(DefaultSpecialEffectsController.java:877)
at androidx.fragment.app.DefaultSpecialEffectsController.startAnimations(DefaultSpecialEffectsController.java:176)
at androidx.fragment.app.DefaultSpecialEffectsController.executeOperations(DefaultSpecialEffectsController.java:126)
at androidx.fragment.app.SpecialEffectsController.executePendingOperations(SpecialEffectsController.java:306)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1914)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1825)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1762)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:547)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8309)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)