Merge "Check null of getActivity() when needed."