title: Dynamically load an image into a dialog box
body: <p>How can I dynamically load an image into a dialog box in android </p>
  
  <pre><code>public Dialog onCreateDialog(Bundle savedInstanceState) {
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());       
          LayoutInflater inflater = getActivity().getLayoutInflater();
          builder.setView(inflater.inflate(R.layout.popup, null));
  }
  </code></pre>
  
  <p>I can only link static buttons and images into the view. </p>
  
  <p>If I try to link images dynamically like </p>
  
  <pre><code>ImageView image = (ImageView) getActivity().findViewById(R.id.image);
  image.setImageResource(R.drawable.icon);
  </code></pre>
  
  <p>image is being returned as a null object</p>