I want to hide the whole group from ExpandableListView
if it does not have children. I tried using this in public View getGroupView
:
if (getChildrenCount(groupPosition) == 0) { convertView.setVisibility(View.INVISIBLE); lblListHeader.setVisibility(View.INVISIBLE); } else { convertView.setVisibility(View.VISIBLE); lblListHeader.setVisibility(View.VISIBLE); }
But that does not work. I still see the indicator (text deleted) and empty space.
Also I tried this:
if (getChildrenCount(groupPosition) == 0) { convertView = layoutInflater.inflate(R.layout.blank_layout, null); }
This works, but when I try to open another group, I get java.lang.NullPointerException
.
Is it possible to hide a group (s) from an ExpandableListView
if it has no children?
source share