lundi 7 septembre 2015

Adapters and Loaders for complex data set in Android

I am finding it difficult how to implement adapters or loaders to efficiently load data from an SQL database and showing it into an application.

I store accounts and users in a SQLite database:

  • An account has its own data like the name, the payment information, dates, etc
  • Users have their name, picture filename, and some other information.
  • Data is accessed via a ContentProvider that exposes account and user elements.

I would like to retrieve the list of accounts from the database, and display them using a custom layout that should contain the users of each. Each user has its own layout (basically a picto).

My problem is that I don't know how to structure the adapters and loaders so that each account displays the dynamic amount of users (some may have one, some three, five... etc).

  • The application has a listener service that receives network connections and creates, deletes and modifies users depending on the command it receives.

So, would it be possible to implement this structure in such a way that data is loaded in the background and displayed without interfering with the UI? Also, it would be phenomenal if every time the underlying data is modifed the UI reflects this (modifying, creating or deleting an user from an account, etc)

In my head this sounds like nesting two adapters but I don't know if this is possible or I am missing something.

Thank you very much in advance.

Aucun commentaire:

Enregistrer un commentaire