Java tutorial
//package com.java2s; import android.graphics.drawable.Drawable; import android.view.View; public class Main { /** * Sets the background image for a view. */ public static void setBackgroundImage(View view, Drawable drawable) { view.setBackgroundDrawable(drawable); view.requestLayout(); } public static void setBackgroundDrawable(View view, Drawable drawable) { view.setBackgroundDrawable(drawable); view.invalidate(); } }