content: package net.ellerton.japng.android.demo.index;
  
  import android.content.Context;
  import android.graphics.Typeface;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseExpandableListAdapter;
  import android.widget.TextView;
  
  import net.ellerton.japng.android.demo.R;
  import net.ellerton.japng.android.demo.util.IntentInflater;
  
  import java.util.Map;
  import java.util.List;
  
  public class IndexExpandableListAdapter extends BaseExpandableListAdapter {
  
      private Context context;
      private List<String> listDataHeader; // header titles
      // child data in format of header title, child title
      private Map<String, List<Object>> listDataChild;
  
      public IndexExpandableListAdapter(Context context, List<String> listDataHeader,
                                        Map<String, List<Object>> 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 Object child = getChild(groupPosition, childPosition);
          final IntentInflater inflater = (child instanceof IntentInflater) ? (IntentInflater) child : null;
          final String childText = child.toString(); // (inflater == null) ? child.toString() : inflater. ?;
          //(String) getChild(groupPosition, childPosition);
  
          if (convertView == null) {
              LayoutInflater layoutInflater = (LayoutInflater) this.context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = layoutInflater.inflate(R.layout.index_list_item, null);
          }
  
          TextView txtListChild = (TextView) convertView
                  .findViewById(R.id.indexListTextItem);
  
          txtListChild.setText(childText);
          convertView.setTag(R.id.index_item_object, child);
          return convertView;
      }
  
      @Override
      public int getChildrenCount(int 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 layoutInflater = (LayoutInflater) this.context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = layoutInflater.inflate(R.layout.index_list_group, null);
          }
  
          TextView lblListHeader = (TextView) convertView
                  .findViewById(R.id.indexListHeader);
          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;
      }
  }
  