How to implement filter in ExpandableListView with HashMap
<p>So, i saw one example that can work out if i'm initializing two arrays for expandable list view, but in my case i have one array for header data, and one String for child data and both are stored in HashMap. Took an example from <a href="http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/" rel="nofollow noreferrer">here</a>. How could i achieve this?</p>

<p><strong>UPDATE</strong></p>

<p>I have added a new filter to adapter, but for some reason i'm not getting any data, or even an error. What i'm doing wrong?</p>

<pre><code>public class SearchExpadanbleAdapter extends BaseExpandableListAdapter
                    implements Filterable {
private Context _context;
private List&lt;String&gt; _listDataHeader; // header titles
// child data in format of header title, child title
private HashMap&lt;String, List&lt;String&gt;&gt; _listDataChild;

public SearchExpadanbleAdapter(Context context, List&lt;String&gt; listDataHeader,
                             HashMap&lt;String, List&lt;String&gt;&gt; listChildData) {
    this._context = context;
    this._listDataHeader = listDataHeader;
    this._listDataChild = listChildData;
}

@Override
public int getGroupCount() {
    return this._listDataHeader.size();
}

@Override
public int getChildrenCount(int groupPosition) {
    return this._listDataChild.get(this._listDataHeader.get(groupPosition))
            .size();
}

@Override
public Object getGroup(int groupPosition) {
    return this._listDataHeader.get(groupPosition);
}

@Override
public Object getChild(int groupPosition, int childPosititon) {
    return this._listDataChild.get(this._listDataHeader.get(groupPosition))
            .get(childPosititon);
}

@Override
public long getGroupId(int groupPosition) {
    return groupPosition;
}

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

@Override
public boolean hasStableIds() {
    return false;
}

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup viewGroup) {
    String headerTitle = (String) getGroup(groupPosition);
    if (convertView == null) {
        LayoutInflater infalInflater = (LayoutInflater) this._context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.suggest_item_header, null);
    }

    TextView lblListHeader = (TextView) convertView
            .findViewById(R.id.text_header);
    lblListHeader.setText(headerTitle);

    return convertView;
}

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup viewGroup) {
    final String childText = (String) getChild(groupPosition, childPosition);

    if (convertView == null) {
        LayoutInflater infalInflater = (LayoutInflater) this._context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.suggest_item, null);
    }

    TextView txtListChild = (TextView) convertView
            .findViewById(R.id.suggestion_text);

    txtListChild.setText(childText);
    return convertView;
}

@Override
public boolean isChildSelectable(int i, int i1) {
    return true;
}

public void notifyDataSetInvalidated() {
    super.notifyDataSetInvalidated();
}

@Override
public Filter getFilter() {
    Filter filter = new Filter() {
        @Override
        protected FilterResults performFiltering(CharSequence constraint) {
            FilterResults filterResults = new FilterResults();
            if (!TextUtils.isEmpty(constraint)) {

                // Retrieve the autocomplete results.
                Map&lt;String, List&lt;String&gt;&gt; searchData = new HashMap&lt;&gt;();

                for (Map.Entry&lt;String, List&lt;String&gt;&gt; map : _listDataChild.entrySet()) {
                    if (map.getKey().toLowerCase().startsWith(constraint.toString().toLowerCase())) {
                        _listDataHeader.add(map.getKey());
                        searchData.put(map.getKey(), map.getValue());
                    }
                }

                // Assign the data to the FilterResults
                filterResults.values = searchData;
                filterResults.count = searchData.size();
            }
            return filterResults;
        }

        @Override
        protected void publishResults(CharSequence constraint, FilterResults results) {
            if (results.values != null) {
                _listDataChild = (HashMap&lt;String, List&lt;String&gt;&gt;) results.values;
                notifyDataSetChanged();
            }
        }
    };
    return filter;
}
</code></pre>