SyntaxFix
Write A Post
Hire A Developer
Questions
Fragment lifecycle is very complex and full of bugs, try to add:
Activity activity = getActivity(); if (isAdded() && activity != null) { ... }