Set getChildView() to return only selected rows
<p>I have a BaseExpandableListAdapter class and getChildView() has to return only a couple rows. But, of course, returning null will crash the app and setting the visibility to GONE will create a blank space in the list.</p>

<p>So, the user has a checkbox in each row, and when one is checked the next time he opens the list it won't appear (like being deleted from the ArrayAdapter, but I can't do that).</p>

<p>Any good option?</p>

<p><strong>EDIT</strong></p>

<pre><code>@Override
public int getChildrenCount(int groupPosition) {
    int childrenCount = categories.get(groupPosition).size();
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);

    /** If the user wants to remove the completed items */
    if (settings.getBoolean("deleteCompletedItemsPref", false) == true) {
        for (int childPosition=0; childPosition&lt;childrenCount; childPosition++) {
            if (categories.get(groupPosition).getItem(childPosition).isChecked()) {
                parent.removeViewAt(childPosition);
            }
        }
    }

    return childrenCount;
}
</code></pre>

<p>Here I run the group's children and try to remove the unwanted views, although I can't remove views here because is an AdapterView.</p>
