2

I am creating an application that does not store any data (other than basic user name, password, etc). It uses API calls to get data and displays them when loaded through Volley.

I know typically it is best practice to use content providers and loaders when you store things in SQLite. My question is: should I still be using content providers and loaders given that my app does not utilize a database. Does anyone have any best practices/tutorials on how to do so with Volley?

Thanks!

John
  • 1,677
  • 4
  • 15
  • 26

1 Answers1

1

It depends on your use cases. But here, no there is no need. There are other callback mechanisms you can use like broadcasts, async tasks, handlers or even content observers. There is a nice official tutorial of how to communicate with the UIThread aka. the visible stuff from some background logic.

Also if you want to you also can use loaders without any content provider. See this so post for more informations.

Community
  • 1
  • 1
GPuschka
  • 522
  • 3
  • 9
  • As far as I understand, Volley performs much of the network requests in a separated thread, meaning, Volley has its own callback mechanism. What are the advantages of using other callback mechanisms, or, why should we use other mechanisms? Is it because we use some boilerplate code for handling Volley requests and we want to write them only once? Also - is it because the Volley listeners are executed on the UI Thread? – lionheart Jun 14 '16 at 09:37