title: NullPointerExecption in bundle after AsyncTask
body: <p>I'm having a problem with this Activity.</p>
  
  <pre><code>    package com.ilocal.diary;
  import java.util.ArrayList;
  
  import org.apache.http.NameValuePair;
  import org.apache.http.message.BasicNameValuePair;
  
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.os.AsyncTask;
  import android.os.Bundle;
  
  public class ViewDiary extends Activity {
  
      private String userid = "1";
      private String response;
      private String url;
      private Bundle bundle = new Bundle();
      private ArrayList&lt;NameValuePair&gt; postParameters;
      private ProgressDialog dialog = null;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.empty_layout);
  
          this.dialog = ProgressDialog.show(this, "Working..", "Downloading Data...", true, false);
  
          bundle = this.getIntent().getExtras();
          if (bundle != null) {
              userid = bundle.getString("USERID");
          }
          url ="http://www.ilocaltest.x10.mx/android/fetchdiary.php";
          postParameters = new ArrayList&lt;NameValuePair&gt;();
          postParameters.add(new BasicNameValuePair("userid", userid));
  
          new PHPQuery().execute(url, postParameters);
      }
  
      private class PHPQuery extends AsyncTask&lt;Object, Void, String &gt; {
          protected String doInBackground(Object... params) {
              try {
                  response = CustomHttpClient.executeHttpPost(url, postParameters);
              } catch (Exception e) {
                  System.out.println("HTTP error - " + e.toString());
              }
              System.out.println(response);
              return response;
          }
  
          protected void onPostExecute(String result) {
              dialog.dismiss();
              System.out.println(result);
              if (!(result == null)) {
                  bundle.putString("RESPONSE", result);
                  Intent i = new Intent(ViewDiary.this, DisplayDiary.class);
                  i.putExtras(bundle);
                  startActivity(i);
                  ViewDiary.this.finish();
              }
              else
                  finish();
          }
      }
  }
  </code></pre>
  
  <p>Everything is working until i try the bundle the result from the AsyncTask when I get a nullpointerexecption in the line</p>
  
  <pre><code>bundle.putString("RESPONSE", result);
  </code></pre>
  
  <p>I know that the result has been passed to the onPostExecute method so where is the exception coming from and how can fix it.</p>
  
  <p>Martin</p>