Fix crash with IllegalStateException: No Activity