Android examples for User Interface:View Background
Set View Background by ID
//package com.java2s; import android.view.View; public class Main { public static Boolean SetViewBackground(View parentView, int nViewId, int nBkgId) { View view = (View) parentView.findViewById(nViewId); if (view == null) { return false; }/* w ww. ja va2 s . c om*/ view.setBackgroundResource(nBkgId); return true; } }