Created
October 29, 2020 14:32
-
-
Save gavelez/9a0743644d921d8fc9d14ba39cb3cbc4 to your computer and use it in GitHub Desktop.
Validate if a Fragment is active
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isSafeFragment( Fragment frag ) | |
{ | |
return !(frag.isRemoving() || frag.getActivity() == null || frag.isDetached() || !frag.isAdded() || frag.getView() == null ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment