Using loaders to display data from SQLlite in listview in fragments

129 Views Asked by At

My app implementation is an activity which uses Viewpager and different fragments to show on screen depending on tab selection or user swiping the screen. I have attached the screenshot example.enter image description here

Now I want to load data on these fragments from my database in a listview. I was reading about loaders but not sure how to implement - whether to use Cursorloader which uses content provider or to use Asynctaskloader. I want to avoid Cursorloader since it mandates uses of content provider, however let me know if it will still make sense to go for it rather than Asynctaskloader. Also, can I use a single loader maybe in activity and use this loader to display data in different fragments? Or should I be implementing a loader for each of the fragments? Before thinking to use loaders I previously had used Simplecursoradapter to display the results but I have heard its better to use loaders for asynchronous operations. But let me know if Simplecursoradapter will suffice for lightweight operation.

I know I have asked too many questions but I am a beginner and a little confused at this point. Please help.

0

There are 0 best solutions below