Why does setTextFilterEnabled(true) not work?

by guishenl...@gmail.com » Thu, 30 Jul 2009 17:44:02 GMT


Sponsored Links
 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.os.Bundle;
import android.widget.ArrayAdapter;


/**
 * A list view example where the
 * data for the list comes from an array of strings.
 */
public class List1 extends ListActivity {

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

        // Use an existing ListAdapter that will map an array
        // of strings to TextViews
        setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, mStrings));
      getListView().setTextFilterEnabled(true);
    }

    private String[] mStrings = {
            "Action", "Adventure", "Animation", "Children", "Comedy",
"Documentary", "Drama",
        "Foreign", "History", "Independent", "Romance", "Sci-Fi",
"Television", "Thriller"


}

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. documentation

Hi,

Since I've 'rant'ed once or twice I thought I'd do the opposite for
once. The new doc for the sdk imho is unbelievably better than the
last version. It still has some gaping holes but I'm happy with the
progress.

Mark
--~--~---------~--~----~------------~-------~--~----~

2. [WTA] Samsung Continuum CDMA

Ada yg punya pengalaman inject flexi ke Samsung Continuum?

-- 
"

3. create a new android process and start when the OS starts

4. Keep a service running continuously

5. Programmatically add contact and start Dialer with some delay

6. (2nd try) Segmentation fault when loading a certain class from an OSGi framework under Android 2.2 & 2.3

7. Android and JMX