Merge "Guarded the getActivity() call" into jb-mr1-dev