title: Toast in Android fragments showing null pointer expn
body: <p>I am getting errors on few devices where I am trying to display a toast inside fragments. this toast is usually on retrofit response failure. toast code is simple. Please suggest, could not find any reason searching here and there.</p>
  
  <pre><code>Toast.makeText(getActivity(), "Connection Failure", Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>and my ST logs are below.</p>
  
  <pre><code>Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
     at android.widget.Toast.(Toast.java:103)
     at android.widget.Toast.makeText(Toast.java:256)
  </code></pre>