title: Androids ExpandableListView - where to put the button listener for buttons that are children
body: <p>I have been playing around a lot with the ExpandableListView and I cannot figure out where to add the button listeners for the button that will be the children in the view. I did manage to get a button listener working that uses getChildView() below, but it seems to be the same listener for all the buttons.</p>
  
  <p>The best case scenario is that I would be able to implement the button listeners in the class that instantiates the ExpandableListAdapter class, and not have to put the listeners in the actual ExpandableListAdapter class. At this point I don't even know if that is possible</p>
  
  <p>I have been experimenting with this tutorial/code: <a href="http://shenhengbin.wordpress.com/2012/03/25/android-practice-custom-expandablelistview-sample-2/" rel="nofollow">HERE</a></p>
  
  <p><strong>getChildView()</strong></p>
  
  <pre><code>@Override
  public View getChildView(int set_new, int child_position, boolean view, View view1, ViewGroup view_group1)
  {
      ChildHolder childHolder;
      if (view1 == null)
      {
  
          view1 = LayoutInflater.from(info_context).inflate(R.layout.list_group_item_lv, null);
  
          childHolder = new ChildHolder();
  
          childHolder.section_btn = (Button)view1.findViewById(R.id.item_title);
          view1.setTag(childHolder);
          childHolder.section_btn.setOnClickListener(new OnClickListener()
          {
  
              @Override
              public void onClick(View v)
              {
                  Toast.makeText(info_context, "button pushed", Toast.LENGTH_SHORT).show();
  
              }
          });
  
  
  
      }else {
          childHolder = (ChildHolder) view1.getTag();
      }
          childHolder.section_btn.setText(children_collection.get(set_new).GroupItemCollection.get(child_position).section);
          Typeface tf = Typeface.createFromAsset(info_context.getAssets(), "fonts/AGENCYR.TTF");
  
          childHolder.section_btn.setTypeface(tf);
          return view1;
  }
  </code></pre>
  
  <p>Any help would be much appreciated. Thank you and I will be standing by.</p>