-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populate list of items #12
Comments
@danielpassos how do you get RuntimeException? In my example if I remove the call from updateDataset (the only point where is called) it simply doesn't filter anymore. filterItems is a new function, but it's an option for the developer to call it if he wants to use the search, but being protected it cannot be called from the Activity and it must be called from the adapter implementation. You also say that the constructor should accept the list and assign it to mItems? |
I mean if you don't call
Yes. I think it's more natural/intuitive/commons for developer. In 100% of adapters, we pass the list of data in constructor (like in ArrayAdapter). It make sure we always will have the data set |
The reason the constructor doesn't accept the list, it's that updateDataset is called often in the Activity, so it's nice to centralize the point where the data is loaded and I've identified that method. PS. Better if you keep tabulation to indent the code. |
For the moment I added a constructor that accept the list and initialize mItems. |
It is not so clear only looking for the API or reading the wiki, you need populate the list of items in
FlexibleAdapter
using the methodfilterItems
. If you don't do that you will get a RuntimeException.IMHO populate the list of items should be a construction responsabilite. Wdyt?.
The text was updated successfully, but these errors were encountered: