Android examples for User Interface:View Child
set Child View On Click Listener
/*// ww w .j a v a 2 s . com * * * * Copyright 2012 fenbi.com. All rights reserved. * * FENBI.COM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * */ //package com.java2s; import android.view.View; import android.view.View.OnClickListener; public class Main { public static View setChildOnClickListener(View parent, int cid, OnClickListener listener) { if (parent != null) { View v = parent.findViewById(cid); if (v != null) { v.setOnClickListener(listener); } return v; } return null; } public static void setChildOnClickListener(View parent, int[] cids, OnClickListener listener) { if (parent != null && cids != null) { for (int cid : cids) { View v = parent.findViewById(cid); if (v != null) { v.setOnClickListener(listener); } } } } }