Possible fix for a safer side is to add a condition to check whether your activity or fragment is alive or not. This is especially important if you are using the fragment lifecycle callbacks such as onAttach() and onDetach().