The system doesn't do the filtering automatically, because it wouldn't know how to filter your Cursor based on the string. You basically need to rerun the query with a new where-clause every time the user types something. If you have your own Adapter, you can easily do this by implementing runQueryOnBackgroundThread(). If you're using SimpleCursorAdapter directly, I think you need to set your own FilterQueryProvider for it.
On Sat, Feb 14, 2009 at 2:01 AM, Parakoos <[email protected]> wrote: > > I want to display all contacts with a phone number in a list. I got > the data, it is displayed in the list but my problem is that I can't > get the text filter functionality to work. E.g. when the user types > 'fre' it should filter out all entries not containing 'fre'. > > This is what I've got in the ListActivity.onCreate() > > [syntax="java"] > Cursor c = this.getContentResolver().query(People.CONTENT_URI, > new String[] { People._ID, People.DISPLAY_NAME }, > People.PRIMARY_PHONE_ID + " IS NOT NULL", > null, > People.DISPLAY_NAME + " asc"); > this.startManagingCursor(c); > > SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, > android.R.layout.simple_list_item_1, > c, > new String[] { People.DISPLAY_NAME }, > new int[] { android.R.id.text1 }); > adapter.setStringConversionColumn(adapter.getCursor().getColumnIndex > (People.DISPLAY_NAME)); > adapter.bindView(getListView(), this, c); > setListAdapter(adapter); > this.getListView().setTextFilterEnabled(true); > [/syntax] > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

