-
-
Save pyadav/b600b15c67f5b62f831fa01ffc39da08 to your computer and use it in GitHub Desktop.
Check if fragment is visible and still not destroyed
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 class FragmentHelper { | |
| public static boolean isFragmentVisible(WeakReference<Fragment> fragment) { | |
| if (fragment!=null && fragment.get() != null && fragment.get().getActivity() != null && | |
| fragment.get() | |
| .isVisible() | |
| && !fragment.get().isRemoving()) { | |
| return true; | |
| } | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment