Should we also check for getView != null here? 
<code>if (!hasActivity() || getView() == null)
                            return;
</code>