-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #1555 #2773
Fixes #1555 #2773
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be fixed, it would get a missing tab:
try {
if (fragmentManager == null) {
fragmentManager = getActivity().getSupportFragmentManager();
}
fragments.add(0, fragmentManager.getFragment(savedInstanceState, "tab" + 0));
fragments.add(1, fragmentManager.getFragment(savedInstanceState, "tab" + 1));
} catch (Exception e) {
e.printStackTrace();
}
And remove the generic Exception.
How? I tried doing this:
But it gave me the following memory leak:
What do you think 🤔 Also, from Telegram group, ICYMI Ref: Your comment on 2772
Yes, we're saving that. Right? So isn't that okay to skip if it is not present in the FragmentManager? (Reference (https://stackoverflow.com/a/26285801/9652621)) |
It would get a missing tab if you call |
I don't understand why you try to add the fragment twice here. Also, the leak seems not related. |
Twice? I was adding the fragment if that was not added since you asked it here
& here
|
Sorry my mistake, why are you adding the fragment here though? I meant for you to add it if its not in the bundle when the fragment is recreated. |
this still happens AFAIK in this solution:
|
How does this fix the issue? |
This will force execute any pending transactions for the fragment manager. So by the time we reach to put fragments in instance state we have both of them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work
Description
Issue tracker
Fixes #1555
Manual tests
Build tasks success
Successfully running following tasks on local:
./gradlew assembledebug
./gradlew spotlessCheck