I am working on an android project where I needed to use contentprovider for thread safe database related operations inside a service. But loadermanager with callbacks is not available to use in service. What is the best replacement for loadermanager inside service that will have callbacks and contentprovider?
Asked
Active
Viewed 1,188 times
1
-
1you don't need it ... use plain loaders by using constructor, registerListener and startLoading – Selvin Sep 11 '14 at 11:35
-
@Selvin can you point me to an example of custom loader? – pratsJ Sep 11 '14 at 12:26
-
I used AsyncQueryHandler to perform the database operations in background. – pratsJ Sep 15 '14 at 17:01
1 Answers
1
You don't need LoaderManager, as your Service don't have configuration changes and restart Activities and Fragments have cause of rotation changes, or user changing tasks. Just use the Loader. Also, see this answer : Can you use a LoaderManager from a Service?