title: Android:set ImageView dynamically?
body: <p>I'm trying to download an image, and create an ImageView dynamically and add it to my layout, but it won't display the image. Here is my code:</p>
  
  <pre><code>ImageView image = new ImageView(this);
  LinearLayout.LayoutParams vp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
  image.setLayoutParams(vp);
  image.setScaleType(ImageView.ScaleType.CENTER_CROP);
  image.setMaxHeight(50);
  image.setMaxWidth(50);
  image.setImageDrawable(avatar);
  theLayout.addView(image);
  </code></pre>
  
  <p>maybe I need to refresh the layout after I add the ImageView? How do you "refresh"?</p>