I am facing trouble with android Oreo. My MainActivity has 4 fragments, which replace each other whenever the user presses tabs. Now the problem is, I am saving a value in a singleton instance in onPause. Whenever the user presses the next tab, onResume of that fragment is called before onPause, so I am not able to retrieve the value from the singleton correctly.
Please use setReorderingAllowed as false to get the normal fragment lifecycle.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
fragmentTransaction.setReorderingAllowed(false);
}
https://developer.android.com/reference/android/app/FragmentTransaction.html#setReorderingAllowed(boolean)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With