title: How to add different child lists for different parents lists in ExpandableListView for Android?
body: <p>I'm using an ExpandableListView to get an expandable list. I have 3 expandable "parent" lists: Price, Details, Notes. I want to be able to add unique child lists for each parent list. But the way its set up now, the same child list is being added for each parent list. How do I make it so I can add unique, separate child lists for Price, Details, and Notes?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class Assignment extends ExpandableListActivity {
  
  int listFlag = 0;
  
  @SuppressWarnings("unchecked")
  public void onCreate(Bundle savedInstanceState) {
      try{
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_assignment);
  
      SimpleExpandableListAdapter expListAdapter =
          new SimpleExpandableListAdapter(
                  this,
                  createGroupList(),              // Creating group List.
                  R.layout.group_row,             // Group item layout XML.
                  new String[] { "Group Item" },  // the key of group item.
                  new int[] { R.id.row_name },    // ID of each group item.-Data under the key goes into this TextView.
                  createChildList(),              // childData describes second-level entries.
                  R.layout.child_row,             // Layout for sub-level entries(second level).
                  new String[] {"Sub Item"},      // Keys in childData maps to display.
                  new int[] { R.id.grp_child}     // Data under the keys above go into these TextViews.
              );
          setListAdapter( expListAdapter );       // setting the adapter in the list.
  
      }catch(Exception e){
          System.out.println("Errrr +++ " + e.getMessage());
      }
  }
  
  
  //Create Headings of Assignment attributes
  private List createGroupList() {
      ArrayList result = new ArrayList();
  
      //Create string array for Topic headings
      String[] topics = {"Price", "Details", "Notes"};
  
      //Iterate through array of names to lay them out correctly
      for( int i = 0 ; i &lt; 3 ; ++i ) { 
          listFlag = i;
        HashMap m = new HashMap();
        m.put( "Group Item", topics[i] ); // the key and it's value. 
        result.add( m );
      }
      return (List)result;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>@SuppressWarnings("unchecked")
  private List createChildList() {
  
      ArrayList result = new ArrayList();
      for( int i = 0 ; i &lt; 3 ; ++i ) { // this -15 is the number of groups(Here it's fifteen)
        /* each group need each HashMap-Here for each group we have 3 subgroups */
        ArrayList secList = new ArrayList();
        for( int n = 0 ; n &lt; 1 ; n++ ) {
          HashMap child = new HashMap();
          child.put( "Sub Item", " "test"));
          secList.add( child );
        }
       result.add( secList );
      }
      return result;
  }
  </code></pre>