0

I am looking for some help to find a powerfull way to allow selection of different List items. My case is that i have for exemple a List profiles, List teams ... and i'd like to have an autocomplete input that will show, for exemple if i type Al, all Teams and Profiles objects having there member variable name begining by Al. The result would be that i could get from the activity, on submit click performed, a List & a List containing all the objects who have been selected through the autocomplete form. Also i'd like that the list offered to the user that match the chars he typed show the name and a picture (facebook like tag selection).

Obviously i am not asking for some code but at least some guidelines from experienced Android devs who know what to do and not to do to create this kind of thing.

Thanks

1 Answers1

0

Loader are one of the best way to filter list. You init a loader which take the String constraint used for filter, the each time the user type, you update the constraint and restart your Loader.

If I suppose that all your object are cached in a SQLite database you can use a CursorAdapter, Cursor and CursorLoader. You create the needed CursorLoader by filter the query with the content of the EditText.

If you're not familiar with CursorLoader there is the AsyncTaskLoader, with this you won't have the need of DB and to code a provider which can accept raw query. Your object in ListA, ListB, etc must inherits of common class (hum... DataThing maybe :-)), you concatenate the objects in a list then you can filter the list : What is the best way to filter a Java Collection?

That's for the data filtering. Now in order to display the data the way you want, you can display of list below the EditText field or create a custom component if you want a more advanced look.

Community
  • 1
  • 1
Kowlown
  • 920
  • 10
  • 26