Coder Social home page Coder Social logo

Populate list of items about flexibleadapter HOT 4 CLOSED

davideas avatar davideas commented on September 21, 2024
Populate list of items

from flexibleadapter.

Comments (4)

davideas avatar davideas commented on September 21, 2024

@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?

from flexibleadapter.

danielpassos avatar danielpassos commented on September 21, 2024

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.

I mean if you don't call updateDataset nor filterItems you got a NPE. I'll create a new blank project to show you the problem.

You also say that the constructor should accept the list and assign it to mItems?

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

from flexibleadapter.

davideas avatar davideas commented on September 21, 2024

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.
I can try but I need some time to apply the changes in a convenient way.

PS. Better if you keep tabulation to indent the code.

from flexibleadapter.

davideas avatar davideas commented on September 21, 2024

For the moment I added a constructor that accept the list and initialize mItems.
Then, it's always the developer that should call super(List) or still initialize mItems by himself in his Adapter implementation.

from flexibleadapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.