Search code examples
androidjsonlistviewandroid-arrayadapterandroid-cursoradapter

CursorAdapter vs ArrayAdapter for a ListView


I want to fill my ListView with data that's going to come from the web in the form of JSON. The list should be theoretically infinite, with the app making requests for more data if scrolled to the bottom.

  • Should I use a Cursor or an Array(List) adapter to link my online database with my ListView?
  • More generally, what are the arguments to consider when choosing between cursor and array?

Solution

  • Well I think you should look at ContentProviders. They are more natural to the problem that you are trying to solve. You have to implement your custom Cursor which ContentProvider returns on a query request.

    Ref:

    http://developer.android.com/guide/topics/providers/content-providers.html