Java tutorial
//package com.java2s; import android.app.Activity; import android.view.View; import android.widget.ImageView; public class Main { public static void updateRight(View view, int resourceId) { if (view != null && view instanceof ImageView) { ((ImageView) view).setImageResource(resourceId); } else { view.setBackgroundResource(resourceId); } view.setVisibility(View.VISIBLE); } public static void updateRight(Activity activity, int viewId, int resourceId) { View view = activity.findViewById(viewId); updateRight(view, resourceId); } }