title: NullPointerException on getActivity() Fragment
body: <p>Currently in a <code>Fragment</code> I run a normal <code>Toast.makeText()</code> command. The command takes time to execute as it is inside a <code>Volley</code> operation. During the time that the <code>Toast</code> actually does appear the user has time to go back to previous <code>Fragment</code>s. If in that situation the user goes back to the previous <code>Fragment</code>, a <code>NullPointerException</code> occurs.</p>
  
  <pre><code>11-28 13:53:53.965: E/AndroidRuntime(22654): FATAL EXCEPTION: main
  11-28 13:53:53.965: E/AndroidRuntime(22654): Process: com.developmentcheck.dcforpublic, PID: 22654
  11-28 13:53:53.965: E/AndroidRuntime(22654): java.lang.NullPointerException
  11-28 13:53:53.965: E/AndroidRuntime(22654):    at android.widget.Toast.&lt;init&gt;(Toast.java:93)
  11-28 13:53:53.965: E/AndroidRuntime(22654):    at android.widget.Toast.makeText(Toast.java:241)
  </code></pre>
  
  <p>The code :</p>
  
  <pre><code>Toast.makeText(
          getSherlockActivity(),
          "Sorry something went wrong. Please update again.",
          Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>It is used in the following method(which is called in the <code>onActivityCreated</code>):</p>
  
  <pre><code>public void castVote(final String id, int vote_state,
          final String situations) throws JSONException {
  
  JsonObjectRequest jsrq = new JsonObjectRequest(Request.Method.POST,
          url, json, new Response.Listener&lt;JSONObject&gt;() {
  
              @Override
              public void onResponse(JSONObject response) {
                  // TODO Auto-generated method stub
                  Log.i("JSON_RESPONSE_VOTE", response.toString());
                  Toast.makeText(getSherlockActivity(), "Your vote was sent",
                          Toast.LENGTH_LONG).show();
              }
          }, new Response.ErrorListener() {
  
              @Override
              public void onErrorResponse(VolleyError error) {
                  // TODO Auto-generated method stub
                  Toast.makeText(
                          getSherlockActivity(),
                          "Sorry something went wrong. Please update again.",
                          Toast.LENGTH_LONG).show();
  
              }
          });
  </code></pre>
  
  <p>Please help.</p>