Filter ListView Based on user input's in Android?
<p>I need to filter List View as per the user's input in the Edit Text Field.If the user Enter the letter 'a' i need to show the list items starts with 'a'.Can anyone give some ideas to me to solve this ? Thanks in advance?  </p>

<pre><code>void searchEngine(final String[] strArr){
      LinearLayout llay=new LinearLayout(this);
      llay.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));        
      llay.setOrientation(LinearLayout.VERTICAL);

      final ListView lv=new ListView(this);        
      lv.setAdapter(new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_checked, strArr));      


      final EditText ed=new EditText(searcher.this);
      ed.setWidth(80);
      ed.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // TODO Auto-generated method stub
             lv.setTextFilterEnabled(true);
             String strfilter=ed.getText().toString();
             lv.setFilterText(strfilter);

            return false;
        }
    });

      llay.addView(ed);
      llay.addView(lv);


    setContentView(llay);

}
</code></pre>
