title: How to add a header row to a list of child views of an expandablelistview that uses simplecursortreeadapter
body: <p>I'm using a simplecursortreeadapter to populate an expandablelistview and want to have a row at the top of all the children views that has titles for the data.</p>
  
  <ol>
  <li>Group 1 Name <em>[Expanded]</em>
  
  <ul>
  <li><strong>Header (Date, Name, $)</strong></li>
  <li>Child 1 (07/12/2017, Chad, 50.00)</li>
  <li>Child 2 (08/11/2017, Mike, 63.21)</li>
  </ul></li>
  <li>Group 2 Name <em>[Expanded]</em>
  
  <ul>
  <li><strong>Header (Date, Name, $)</strong></li>
  <li>Child 1 (03/25/2017, Ken, 23.97)</li>
  <li>Child 2 (01/25/2017, Will, 101.11)</li>
  </ul></li>
  <li>Group 3 <em>[Collapsed]</em></li>
  </ol>
  
  <p>Is it possible to have the textviews that contain the 3 sets of header text (Date, Name, $) to only appear when the group is expanded? Since the SimpleCursorTreeAdapter handles adding the cursor data into the views, I'm not sure how to add a row to that or how to achieve this. Is this possible?</p>
  
  <p>Edit: Here is my adapter class:</p>
  
  <pre><code>package com.example.myproject.michaelc.billme;
  
  import android.content.Context;
  import android.database.Cursor;
  import android.database.MatrixCursor;
  import android.database.MergeCursor;
  import android.support.v4.content.Loader;
  import android.util.Log;
  import android.widget.SimpleCursorTreeAdapter;
  
  import com.example.myproject.michaelc.billme.data.BillMeContract;
  
  import java.util.HashMap;
  
  public class PayeeCursorAdapter extends SimpleCursorTreeAdapter {
  
  private final String LOG_TAG = getClass().getSimpleName();
  private PayeeActivity mActivity;
  protected final HashMap&lt;Integer, Integer&gt; mGroupMap;
  
  // No cursor is added to the adapter so that it only runs when the CursorLoader runs, instead of every time the activity does
  public PayeeCursorAdapter(
          Context context,        // The activity where the adapter will be running
          int groupLayout,        // The .xml layout file for the group layout
          int childLayout,        // The .xml layout file for the child layout
          String[] groupFrom,     // String of column names in the cursor that is the data for each group item
          int[] groupTo,          // The ID of the views in the group layout that display the column from the groupFrom String[]
          String[] childrenFrom,  // String of column names in the cursor that is the data for each child item
          int[] childrenTo) {     // The ID of the views in the child layout that display the column from the childFrom String[]
  
      super(context, null, groupLayout, groupFrom, groupTo, childLayout, childrenFrom, childrenTo);
      mActivity = (PayeeActivity) context;
      mGroupMap = new HashMap&lt;Integer, Integer&gt;();
  }
  @Override
  protected Cursor getChildrenCursor(Cursor groupCursor) {
  
      int groupPos = groupCursor.getPosition();
      int groupId = groupCursor.getInt(groupCursor.getColumnIndex(BillMeContract.PayeeEntry._ID));
  
      Log.d(LOG_TAG, "getChildrenCursor() for groupPos " + groupPos);
      Log.d(LOG_TAG, "getChildrenCursor() for groupId " + groupId);
  
      mGroupMap.put(groupId, groupPos);
      Loader&lt;Cursor&gt; loader = mActivity.getSupportLoaderManager().getLoader(groupId);
  
      if(loader != null &amp;&amp; !loader.isReset()) {
          mActivity.getSupportLoaderManager().restartLoader(groupId, null, mActivity);
      } else {
          mActivity.getSupportLoaderManager().initLoader(groupId, null, mActivity);
      }
      return null;
  }
  
  public HashMap&lt;Integer, Integer&gt; getGroupMap(){
      return mGroupMap;
  }
  }
  </code></pre>