there are fragments in viewPager and each fragment has a viewModel.
when viewpager's current item changes ,fragment is destroyed ,viewModel onCleared is called and viewModelScope is cancelled
there are 2 problems , first after returning back to same fragment, viewModelScope is cancelled and can't launch any coroutines. second when viewPager's current item is changing , the launched coroutine is cancelled.
how can i solve this issues?
i use FragmentStatePagerAdapter with BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT and OffscreenPageLimit is the default value.