Autoupdate listview based on what the users searches for in an AutoCompleteTextView - android
<p>I've got a customAdapter for my  listview</p>

<pre><code>public class CustomAdapter extends BaseAdapter {

private static ArrayList&lt;Case&gt; cases;

Context c; 
private LayoutInflater mInflater;

/**
 * Constructor for this class
 * @param context Which context triggered this class
 * @param cases Object of each case that will be send and retrieved from the server
 */
public CustomAdapter(Context context, ArrayList&lt;Case&gt; cases) {
    this.cases = cases;
    c = context;
    mInflater = LayoutInflater.from(c);
}



public int getCount() {
    return cases.size();
}


public Object getItem(int position) {
    return cases.get(position);
}

public long getItemId(int position) {
    return position;
}

public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.list_view, null);
        holder = new ViewHolder();
        holder.idField = (TextView) convertView.findViewById(R.id.idNumber);
        holder.dateField = (TextView) convertView.findViewById(R.id.date);

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

    holder.idField.setText("Case number: "+cases.get(position).getCaseNumber());
    holder.dateField.setText(cases.get(position).getDate());

    convertView.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            String PCN = cases.get(position).getCaseNumber(); 
            String date = cases.get(position).getDate(); 

            Toast.makeText(c, "PCN: " + PCN, Toast.LENGTH_LONG).show();

        /*  Intent intent = new Intent(c, CaseHolder.class);
            intent.putExtra("pcn", PCN);
            intent.putExtra("date", date);


            c.startActivity(intent);*/


        }


    });



    return convertView;
}



static class ViewHolder {
    TextView idField;
    TextView dateField;

}
}
</code></pre>

<p>This adapter is set to a ListView like this:</p>

<pre><code> lv.setAdapter(new CustomAdapter(this, list));
</code></pre>

<p>and the list is populated this way:</p>

<pre><code>public ArrayList&lt;Case&gt; getCases() {

    ArrayList temp = new ArrayList&lt;Case&gt;(); 
    Case c1 = new Case("43534534675", 1, new Date().toString());
    Case c2 = new Case("43534534675", 1, new Date().toString());
    Case c3 = new Case("43534534675", 1, new Date().toString());
    Case c4 = new Case("43534534675", 1, new Date().toString());
    Case c5 = new Case("43534534675", 1, new Date().toString());
    Case c6 = new Case("43534534675", 1, new Date().toString());
    Case c7 = new Case("43534534675", 1, new Date().toString());
    Case c8 = new Case("43534534675", 1, new Date().toString());
    Case c9 = new Case("43534534675", 1, new Date().toString());
    Case c10 = new Case("43534534675", 1, new Date().toString());
    Case c11 = new Case("43534534675", 1, new Date().toString());

    temp.add(c1); 
    temp.add(c2);
    temp.add(c3);
    temp.add(c4);
    temp.add(c5);
    temp.add(c6);
    temp.add(c7);
    temp.add(c8);
    temp.add(c9);
    temp.add(c10);
    temp.add(c11);



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

<p>On top of the list in my layout file, I have an <code>AutoCompleteTextView</code> for searching the list. How can I dynamically update the list based on what the users searches for? </p>
