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. Preventing Screen uto Lock while my application is running

Hello,

I read a lot of posts concerning preventing the screen auto lock but
didn't find an efficient way.

Isn't there any simple line I could put to do such a thing? everything
looked so complicated, or didn't work.

thanks
--~--~---------~--~----~------------~-------~--~----~

2. Hwo to use getLineCount method in TextView? what is the internal Layout?

Hi guys,
In my app, there is a TextView ,more than 20 lines .I want to divide
it into multi-screen  display  in  a ScrollView.
when I invoke the getLineCount method ,I get 0(Zero). the reference of
android  developer guide said  "Return the number of lines of text, or
0 if the internal Layout has not been built. " what is the  internal
Layout?
please help!
--~--~---------~--~----~------------~-------~--~----~

3. How to handle this kind of situation within my code

4. How to handle this kind of situation within my code

5. Take a Picture without an Activity

6. How come the accelrometers maximum sampling rate are so low?

7. Emulator quick start