title: NullPointerException imageView.setImageBitmap(bitmap)
body: <p>I'm trying to download an image from a website. This is my code:
  MainActivity</p>
  
  <pre><code>...
  public class MainActivity extends Activity {
  public final static String URL = "com.example.test3.URL";
  ImageView imageView = null;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      if (savedInstanceState == null) {
          getFragmentManager().beginTransaction()
                  .add(R.id.container, new PlaceholderFragment())
                  .commit();
      }
  }
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      int id = item.getItemId();
      if (id == R.id.action_settings) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  public static class PlaceholderFragment extends Fragment {
  
      public PlaceholderFragment() {
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_main, container, false);
          return rootView;
      }
  }
  
  // execute by pressing button
  public void send(View view){
      EditText enter = (EditText) findViewById(R.id.enter);
      String url = enter.getText().toString();
      ImageView imageView = (ImageView) findViewById(R.id.image1);
      new ImageDownload(imageView).execute(url);      
  }
  
  }
  </code></pre>
  
  <p>ImageDownload </p>
  
  <pre><code>public class ImageDownload extends AsyncTask&lt;String, Void, Bitmap&gt;{
  ImageView imageView = null;
  public ImageDownload(ImageView imageView){
      this.imageView = imageView;
  }
  
  /*@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_image_download);
  
      if (savedInstanceState == null) {
          getFragmentManager().beginTransaction()
                  .add(R.id.container, new    PlaceholderFragment()).commit();
      }
      Intent intent = getIntent();
      String urlString = intent.getStringExtra(MainActivity.URL); */
  
  
  @Override
  protected Bitmap doInBackground(String... url) {
      if(url.length &lt;= 0){        
          return null;
      }
      return downloadBitmap(url[0]);
  }
  
  public Bitmap downloadBitmap(String s) {
      String urlString = s;
      URL url;
      InputStream i;
      Bitmap bitmap = null;
      try { 
          url = new URL(urlString);       
          i = url.openStream();
          bitmap = BitmapFactory.decodeStream(i);
      } catch (MalformedURLException e) {
          e.printStackTrace();
      } catch (IOException e){
          e.printStackTrace();
      }
  
      return bitmap;
  }
  
  public void onPostExecute(Bitmap bitmap){
      Log.d("done", "onPostExecute");
      if(bitmap != null){
          this.imageView.setImageBitmap(bitmap);
      }
  }   
  }
  </code></pre>
  
  <p>The program stops with the following log:</p>
  
  <pre><code>05-08 09:52:04.477: D/done(8534): onPostExecute
  05-08 09:52:04.477: D/AndroidRuntime(8534): Shutting down VM
  05-08 09:52:04.477: W/dalvikvm(8534): threadid=1: thread exiting with uncaught exception (group=0x415e7d88)
  05-08 09:52:04.497: E/AndroidRuntime(8534): FATAL EXCEPTION: main
  05-08 09:52:04.497: E/AndroidRuntime(8534): Process: com.example.test3, PID: 8534
  05-08 09:52:04.497: E/AndroidRuntime(8534): java.lang.NullPointerException
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at  com.example.test3.ImageDownload.onPostExecute(ImageDownload.java:90)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at com.example.test3.ImageDownload.onPostExecute(ImageDownload.java:1)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at android.os.AsyncTask.finish(AsyncTask.java:632)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at android.os.AsyncTask.access$600(AsyncTask.java:177)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at android.os.Handler.dispatchMessage(Handler.java:102)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at  android.os.Looper.loop(Looper.java:212)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at android.app.ActivityThread.main(ActivityThread.java:5151)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at java.lang.reflect.Method.invokeNative(Native Method)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at java.lang.reflect.Method.invoke(Method.java:515)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  05-08 09:52:04.497: E/AndroidRuntime(8534):     at dalvik.system.NativeStart.main(Native Method)
  05-08 09:52:05.707: I/Process(8534): Sending signal. PID: 8534 SIG: 9
  </code></pre>
  
  <p>fragment_image_download.xml:</p>
  
  <pre><code>  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.example.test3.ImageDownload$PlaceholderFragment" &gt;
  
  &lt;ImageView
    android:contentDescription="@string/desc"
    android:id="@+id/image1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" &gt;
  &lt;/ImageView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Where does this NullPointerException come from? Can anyone help me please?</p>