I am implementing Edit text with RecyclerView where RecylecerView should update its item and its View when user enter any text in the edit text. It is a very common requirement and i have found tons of solution for this. But i m facing a strange issue that after filtering recylcerView is showing wrong item in the list.
To Illustrate. lets suppose RecylcerView contains items as a,b,c,d and e.
if i search 'c. list shows only one item 'a'. however when i click on this item it is 'c' only. it means only layout not getting updated however values do get updated.
Here is the my implementation.
public class CustomFilter extends Filter{
    private CustomFilter(SListRecyclerViewAdapter mAdapter) {
        super();
    }
    @Override
    protected FilterResults performFiltering(CharSequence constraint) {
        sData.clear();
        final FilterResults results = new FilterResults();
        if (constraint.length() == 0) {
            sData.addAll(filteredsData);
        }
        else {
            final String filterPattern = constraint.toString().toLowerCase().trim();
            for (final S surg: filteredsData) {
                if (S.getSUserName().toLowerCase(Locale.getDefault()).contains(filterPattern)) {
                    sData.add(surg);
                }
            }
        }
        results.values = sData;
        results.count = sData.size();
        return results;
    }
    @Override
    protected void publishResults(CharSequence constraint, FilterResults results) {
        notifyDataSetChanged();
    }
 
     
    