title: different child layout for each Group header in ExpandableListview android
body: <p>I have used <code>ExpandableListview</code>  in which every <code>Group</code> has same <code>child layout</code>.</p>
  
  <p>Now there is a situation , in which every <code>Group</code> has different child layout (some has <code>checkbox</code>, some has <code>imageview</code>, some has <code>textview</code>) depending upon its values fetched from web service</p>
  
  <p>How do I modify My previous <code>ExpandableListAdapter</code>  that has same <code>child layout</code></p>
  
  <p>ExpandableListAdapter.java</p>
  
  <pre><code>public class ExpandableListAdapter extends BaseExpandableListAdapter {
  
      private static final int[] EMPTY_STATE_SET = {};
      private static final int[] GROUP_EXPANDED_STATE_SET =
              {android.R.attr.state_expanded};
      private static final int[][] GROUP_STATE_SETS = {
          EMPTY_STATE_SET, // 0
          GROUP_EXPANDED_STATE_SET // 1
      };
      private Context _context;
      private List&lt;String&gt; _listDataHeader; // header titles
      // child data in format of header title, child title
      private HashMap&lt;String, List&lt;String&gt;&gt; _listDataChild;
  
      public ExpandableListAdapter(Context context, List&lt;String&gt; listDataHeader, HashMap&lt;String, List&lt;String&gt;&gt; listChildData) {
          this._context = context;
          this._listDataHeader = listDataHeader;
          this._listDataChild = listChildData;
      }
  
      @Override
      public Object getChild(int groupPosition, int childPosititon) {
          return this._listDataChild.get(this._listDataHeader.get(groupPosition))
                  .get(childPosititon);
      }
  
      @Override
      public long getChildId(int groupPosition, int childPosition) {
          return childPosition;
      }
  
      @Override
      public View getChildView(int groupPosition, final int childPosition,
              boolean isLastChild, View convertView, ViewGroup parent) {
  
          final String childText = (String) getChild(groupPosition, childPosition);
  
          if (convertView == null) {
              LayoutInflater infalInflater = (LayoutInflater) this._context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = infalInflater.inflate(R.layout.list_child, null);
          }
  
          CheckBox chkListChild = (CheckBox) convertView.findViewById(R.id.list_child_chkbox);
  
  
  
          chkListChild.setText(childText);
          return convertView;
      }
  
      @Override
      public int getChildrenCount(int groupPosition) {
          Log.e("groupPosition", "kargr "+groupPosition);
  
              return this._listDataChild.get(this._listDataHeader.get(groupPosition))
                      .size();
  
  
      }
  
      @Override
      public Object getGroup(int groupPosition) {
          return this._listDataHeader.get(groupPosition);
      }
  
      @Override
      public int getGroupCount() {
          return this._listDataHeader.size();
      }
  
      @Override
      public long getGroupId(int groupPosition) {
          return groupPosition;
      }
  
      @Override
      public View getGroupView(int groupPosition, boolean isExpanded,
              View convertView, ViewGroup parent) {
          String headerTitle = (String) getGroup(groupPosition);              
  
          if (convertView == null) {
              LayoutInflater infalInflater = (LayoutInflater) this._context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = infalInflater.inflate(R.layout.list_group, null);
          }
  
          View ind = convertView.findViewById( R.id.explist_indicator);
          if( ind != null ) {
              ImageView indicator = (ImageView)ind;
              if( getChildrenCount( groupPosition ) == 0 ) {
                  indicator.setVisibility( View.INVISIBLE );
              } else {
                  indicator.setVisibility( View.VISIBLE );
                  int stateSetIndex = ( isExpanded ? 1 : 0) ;
                  Drawable drawable = indicator.getDrawable();
                  drawable.setState(GROUP_STATE_SETS[stateSetIndex]);
              }
          }
  
  
          TextView lblListHeader = (TextView) convertView
                  .findViewById(R.id.lblListHeader);
          lblListHeader.setTypeface(null, Typeface.BOLD);
          lblListHeader.setText(headerTitle);
  
          return convertView;
      }
  
      @Override
      public boolean hasStableIds() {
          return false;
      }
  
      @Override
      public boolean isChildSelectable(int groupPosition, int childPosition) {
          return true;
      }
  }
  </code></pre>