Fix for #981 when the android framework returns NULL for getActivity()

This fixes #981