Java tutorial
//package com.java2s; import android.graphics.drawable.Drawable; import android.widget.ImageView; public class Main { /** * Sets the image for an ImageView. */ public static void setImage(ImageView view, Drawable drawable) { view.setImageDrawable(drawable); if (drawable != null) { view.setAdjustViewBounds(true); } view.requestLayout(); } }