Working with children in ExpandableListActivity
<p>I'm working with an Expandable List, like this:
<img src="http://i.stack.imgur.com/FnHgD.png" alt="alt text"></p>

<p>The Expandable list activity has a method called "OnGroupExpand" which allows you to perform some work before the parent expands and it's children are exposed.</p>

<p>In my case, I want to attach a checkChangeHandler to each child's checkbox so that when it's clicked, I can mark the child as complete. I have the list showing up and the children show when the parent expands, but my check box does nothing.</p>

<p>Then, I try to add checkbox handlers dynamically in the  "onGroupExpand" method. However, when onGroupExpand is triggered <strong>I get an illegal cast exception</strong> when trying to get a reference to each child view.</p>

<pre><code>public void  onGroupExpand (int groupPosition) {

      int numOfChildren = expListAdapter.getChildrenCount(groupPosition);


            for(int i = 0; i &lt; numOfChildren; i++)
            {
                 //Get exception here because getChild() returns Object - but how else can
                 //can I attach a check box to each child?
                 View v = (View) expListAdapter.getChild(groupPosition, i);


                 CheckBox cb = (CheckBox)v.findViewById( R.id.checkComplete ); 
                 cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
                    public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
                        Toast.makeText(getBaseContext(), "Check Changed for " + groupPosition, 2000);
                    }
                  });
             }
</code></pre>

<p>My primary question is about getting a reference to the Child view so that I can attach a handler dynamically. Please see the code comment where I'm trying to do this.
Thanks for your time...</p>
