ExpandableListView -UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView

Seems like Adapterview does not allow adding new view, I encountered same problem

Solve it by replacing following line

convertView  = inflator.inflate(R.layout.child_rows, parent);

to

convertView  = inflator.inflate(R.layout.child_rows, null);

UPDATE

Instead of not using a parent at all, you should simply tell the Inflater not to attach the inflated view to the parent with

convertView = inflator.inflate(R.layout.child_rows, parent, false); 

See also this answer.

The reason is that adapter takes care of attaching views to parent itself.


Note that you can also get this error when your layout xml is invalid.


As were noted above,

Instead of not using a parent at all, you should simply tell the Inflater not to attach the inflated view to the parent with

 convertView = inflator.inflate(R.layout.child_rows, parent, false);     

See also this answer.

The reason is that adapter takes care of attaching views to parent itself.