Is there a way to use the startManagingCursor() within a service instead of an activity, with the same results (as shown here)?
More specifically, i would like to manage a given Cursor’s lifecycle based on a service’s lifecycle. For example, when the service is destroyed, it will automatically call deactivate() on the given Cursor. Also, when the service is created/starts again, it will call requery() method.
- Is it feasible by using an other
appropriate method implemented in the
Service.class? - Is it feasible in some other way?
- Or, is it pointless at all?
No, sorry.
No.
You are welcome to write your own support code to do whatever you want. I doubt you can implement what you’re seeking, though.
IMHO, yes. Having a
Cursorbe automatically closed when the service is destroyed is not a bad idea. However, the notion of thedeactivate()/requery()makes little sense to me in a service. This is also the impossible part, in that you have no place to put the deactivatedCursorthat will be picked up by some future incarnation of your service.