title: Expandable listview with gridview inside on Android
body: <p>I'm trying to pass a array of data to my GridAdapter so I can get that and print as a gridview, the problem is that my current array is returning null, what am I doing wrong here? how can I get the arraylist of child and pass it to my GridAdapter? Thank you in advance.</p>
  
  <pre><code>public class ExpandListAdapter extends BaseExpandableListAdapter {
  
      private Context context;
      private ArrayList&lt;Group&gt; groups;
      private ArrayList&lt;Child&gt; child;
  
      ImageLoader imageLoader = AppController.getInstance().getImageLoader();
  
      public ExpandListAdapter(Context context, ArrayList&lt;Group&gt; groups) {
          this.context = context;
          this.groups = groups;
      }
  
  
  
      @Override
      public Object getChild(int groupPosition, int childPosition) {
          child = groups.get(groupPosition).getItems();
          return child.get(childPosition);
      }
  
      @Override
      public long getChildId(int groupPosition, int childPosition) {
          return childPosition;
      }
  
      @Override
      public View getChildView(int groupPosition, int childPosition,
              boolean isLastChild, View convertView, ViewGroup parent) {
  
          if (convertView == null) {
              LayoutInflater infalInflater = (LayoutInflater) context
                      .getSystemService(context.LAYOUT_INFLATER_SERVICE);
              convertView = infalInflater.inflate(R.layout.gridview, null);
          }
          CustomGridView gridView = (CustomGridView) convertView
                  .findViewById(R.id.GridView_toolbar);
  
          gridView.setNumColumns(3);// gridView.setGravity(Gravity.CENTER);//
          gridView.setHorizontalSpacing(5);// SimpleAdapter adapter =
          GridAdapter adapter = new GridAdapter(context, **child**);
          gridView.setAdapter(adapter);// Adapter
  
          int totalHeight = 0;
          for (int size = 0; size &lt; adapter.getCount(); size++) {
              RelativeLayout relativeLayout = (RelativeLayout) adapter.getView(
                      size, null, gridView);
              TextView textView = (TextView) relativeLayout.getChildAt(0);
              textView.measure(0, 0);
              totalHeight += textView.getMeasuredHeight();
          }
          gridView.SetHeight(totalHeight);
          return convertView;
  
      }
  
      @Override
      public int getChildrenCount(int groupPosition) {
          return 1;
      }
  
      @Override
      public Object getGroup(int groupPosition) {
          return groups.get(groupPosition);
      }
  
      @Override
      public int getGroupCount() {
          return groups.size();
      }
  
      @Override
      public long getGroupId(int groupPosition) {
          return groupPosition;
      }
  
      @Override
      public View getGroupView(int groupPosition, boolean isExpanded,
              View convertView, ViewGroup parent) {
          Group group = (Group) getGroup(groupPosition);
          if (convertView == null) {
              LayoutInflater inf = (LayoutInflater) context
                      .getSystemService(context.LAYOUT_INFLATER_SERVICE);
              convertView = inf.inflate(R.layout.group_item, null);
          }
          TextView tv = (TextView) convertView.findViewById(R.id.group_name);
          tv.setText(group.getName());
          return convertView;
      }
  
      @Override
      public boolean hasStableIds() {
          return true;
      }
  
      @Override
      public boolean isChildSelectable(int groupPosition, int childPosition) {
          return true;
      }
  
  }
  </code></pre>