title: How to map childView in Expandable ListView using volley
body: <p>I am making expandable listview in android using Volley. I have mapped parentView Successfully. But I am facing problem how I map childView in an expandable listview. in my situation, all subcategories are shown in a single parent category. How I can handle this. How I can map properly childView in the expandable listview.
  here is a snapshot of lists which I have shown in logcat.</p>
  
  <p>screenshot :
  <img src="https://i.stack.imgur.com/drOsh.png" alt="child caetgory"> </p>
  
  <p>here is my code from which I am getting a response from JSON.</p>
  
  <pre><code>String ChildName = null;
  JSONObject object = null,childObject= null;
  try {
      object =new JSONObject(response);
      JSONArray headerArray = object.getJSONArray("ListCategories");
      for (int i=0;i&lt;headerArray.length();i++){
          JSONObject jsonObject = headerArray.getJSONObject(i);
          final int Id = jsonObject.getInt("CategoryID");
          final String name = jsonObject.getString("CategoryName");
  
          JSONArray childArray = headerArray.getJSONObject(i).getJSONArray("ListChildCategories");
          for (int j=0;j&lt;childArray.length();j++) {
              childObject = childArray.getJSONObject(j);
              ChildId = childObject.getInt("ID");
              ChildName = childObject.getString("Name");
              child.add(new ChildCategory(ChildId, ChildName));
          }
          Log.e("childArray", childArray.toString());
          header.add(new Category(Id, name));
      }
  
  } catch (JSONException e) {
      e.printStackTrace();
  }
  adapter = new ExpandableCategoryAdapter(context,header,child);
  expandableListView.setAdapter(adapter);
  adapter.notifyDataSetChanged();
  </code></pre>
  
  <p>here is expandable categoryAdapter:</p>
  
  <pre><code>public class ExpandableCategoryAdapter extends BaseExpandableListAdapter {
  
  
      private Context _context;
      private ArrayList&lt;Category&gt; header;
      private ArrayList&lt;ChildCategory&gt; childCategories;
      private HashMap&lt;String, String&gt; child;
      final String name = null;
      private TextView header_text;
  
      public ExpandableCategoryAdapter(Context context, ArrayList&lt;Category&gt; listDataHeader,ArrayList&lt;ChildCategory&gt; listDataChild) {
          this._context = context;
          this.header = listDataHeader;
          this.childCategories = listDataChild;
      }
  
      @Override
      public int getGroupCount() {
          // Get header size
          return header.size();
  
      }
  
      @Override
      public int getChildrenCount(int groupPosition) {
          return childCategories.size();
      }
  
      @Override
      public Object getGroup(int groupPosition) {
          return header.get(groupPosition);
      }
  
      @Override
      public Object getChild(int groupPosition, int childPosition) {
          return childCategories.get(childPosition);
      }
  
      @Override
      public long getGroupId(int groupPosition) {
          return groupPosition;
      }
  
      @Override
      public long getChildId(int groupPosition, int childPosition) {
          return childPosition;
      }
  
      @Override
      public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
          ChildCategory child = (ChildCategory) getChild(groupPosition, childPosition);
          if (convertView == null) {
              LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = infalInflater.inflate(R.layout.list_item_category, parent, false);
          }
          TextView child_text = (TextView) convertView.findViewById(R.id.expandedListItem);
          child_text.setText(child.getName());
          return convertView;
      }
      @Override
      public boolean hasStableIds() {
          // TODO Auto-generated method stub
          return true;
      }
      @Override
      public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
          Category category = (Category) getGroup(groupPosition);
          if (convertView == null) {
              LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = infalInflater.inflate(R.layout.list_group_category, parent, false);
          }
          header_text = (TextView) convertView.findViewById(R.id.listTitle);
          header_text.setText(category.getCategoryName());
          if (isExpanded) {
              header_text.setTypeface(null, Typeface.BOLD);
              header_text.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_extract_black_24dp, 0);
          } else {
              header_text.setTypeface(null, Typeface.NORMAL);
              header_text.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_add_black_24dp, 0);
          }
  
          return convertView;
      }
  
      @Override
      public boolean isChildSelectable(int groupPosition, int childPosition) {
          return true;
      }
  }
  </code></pre>
  
  <p>I don't know where I am doing the mistake. thank you in advance</p>