ArrayAdapter and android:textFilterEnabled

Posted by TiGer on Stack Overflow See other posts from Stack Overflow or by TiGer
Published on 2010-05-17T09:05:11Z Indexed on 2010/05/17 9:10 UTC
Read the original article Hit count: 351

Filed under:
|
|

Hi there, I have created a layout which includes a ListView...

The data shown within this ListView isn't too complicated, it's mostly an Array which is passed when the extended Activity is started...

The rows themselves exist out of an icon and a text, thus an ImageView and a TextView... To fill up the ListView I use an ArrayAdapter simply because an Array is passed containing all the text-items that should be shown..

Now I'd like to actually be able to filter those, thus I found the android:textFilterEnabled paramater to add on the ListView xml declaration... Now a search field is shown nicely but when I enter some letters it won't filter but it will simply delete the whole list... I found out that that's because the textfilter has no idea what it should filter...

So now my question is : I know I need to tell the textfilter what it should filter, I also still have my array filled with the text that should get filtered so how do i couple those two ??? I have seen examples extending a CursorAdapter, but again, I don't have a Cursor, I don't want to do calls to a DB I want to re-utilize my Array with data and obviously the ArrayAdapter itself so that the data will be represented decently on screen (i.e with my ImageView and TextView layout)... Thanks in advance for any help/pointers/tips/code...

© Stack Overflow or respective owner

Related posts about android

Related posts about listview