ArrayAdapter filter return wrong items
<p>I have problem with filtering array adapter with custom object. I owerride custom object toString() so it returns name- which I want filter. Problem is that it filer correct count of items but wrong items. E.g. I have list with items a1,a2, b1,b2. When I enter b it filter and I see a1,a2. Here is my adapter code. I guess problem is there:</p>

<pre><code>class CustomerAdapter extends ArrayAdapter&lt;Customer&gt; {

private LayoutInflater mInflater;
private List&lt;Customer&gt; customers;

public CustomerAdapter(Context context, int textViewResourceId,
        List&lt;Customer&gt; customers) {
    super(context, textViewResourceId, customers);
    mInflater = LayoutInflater.from(context);
    this.customers = customers;
}

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.customers_list_item, null);

        holder = new ViewHolder();
        holder.text = (TextView) convertView
                .findViewById(R.id.textViewCustomerName);
        holder.icon = (LinearLayout) convertView
                .findViewById(R.id.linearLayoutCustomersListEdit);

        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    // Bind the data efficiently with the holder.
    holder.text.setText(customers.get(position).getCustomerName());

    return convertView;
}

static class ViewHolder {
    TextView text;
    LinearLayout icon;
}
</code></pre>

<p>}</p>

<p>Here is filter setup and call:</p>

<pre><code>customerAdapter = new CustomerAdapter(this,
                R.layout.customers_list_item, repository.getCustomers());
setListAdapter(customerAdapter);

etSearch = (EditText) findViewById(R.id.editText_customers_search);
        etSearch.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int arg1, int arg2,
                int arg3) {
            customerAdapter.getFilter().filter(s.toString());
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1,
                int arg2, int arg3) {
        }

        @Override
        public void afterTextChanged(Editable arg0) {
        }
    });

    getListView().setTextFilterEnabled(true);
</code></pre>
