Double child added on expandable listview

android, duplicates, expandablelistadapter, expandablelistview

Solution

It seems you are hard-coded child position like,

  @Override
  public int getChildrenCount(int groupPosition) {
    return 1;
  }

where as it should be `your_data_collection_size`

Also, you have hard-coded childId like,

  @Override
  public long getChildId(int groupPosition, int childPosition) {
    return 0;
  }

which should be `childPosition` not `0`

If you further have any query/problem you can download and check my `demo example from you github` and can come back to me with your query if you have any thereafter.

Problem

I have problem adding children ,when i add one child then on ui two child appear with same childposition..my problem is similar to these mentioned in following questions Child Layout is repeating many times in ExpandableListView https://stackoverflow.com/questions/10938763/double-child-entries-in-expandablelistview But unable to find a solution .. please see my code here Value for children is given using this double dimension array.. ``` String[][] child = { mContext.getResources().getStringArray(R.array.alerts), mContext.getResources().getStringArray(R.array.alerts), mContext.getResources().getStringArray(R.array.alerts), mContext.getResources().getStringArray(R.array.alerts), mContext.getResources().getStringArray(R.array.alerts) }; ``` I used this : ``` @Override public int getChildrenCount(int groupPosition) { return child.length; } ``` but for this also child count is 5 and it shows up 10 items..

Original source