Hi all,
    I want to design a ListView with auto filter fuction, that is,
when the user press a key all the items who matches this key will be
filtered and form a new list.
I selected the method setTextFilterEnabled(true) to implement my
function, but it didn't work in fact.
Could anyone tell me where my mistacke exists?
Thank you in advance!

Here is my code:

package com.example.android.apis.view;


import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Contacts.Phones;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;

 /**
 * A list view example where the
 * data comes from a cursor, and a
 * SimpleCursorListAdapter is used to map each item to a two-line
 * display.
 */
public class List3 extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Get a cursor with all phones
        Cursor c = getContentResolver().query(Phones.CONTENT_URI,
null, null, null, null);
        startManagingCursor(c);

        // Map Cursor columns to views defined in
simple_list_item_2.xml
        ListAdapter adapter = new SimpleCursorAdapter(this,
                android.R.layout.simple_list_item_2, c,
                        new String[] { Phones.NAME, Phones.NUMBER },
                        new int[] { android.R.id.text1,
android.R.id.text2 });
        setListAdapter(adapter);
       //My code begins
        getListView().setTextFilterEnabled(true);
       //My code ends
    }

}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to