Set View Background by ID - Android User Interface

Android examples for User Interface:View Background

Description

Set View Background by ID

Demo Code


//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;
    }
}

Related Tutorials