On Sat, Aug 7, 2010 at 8:17 AM, Rajesh Bachani <[email protected]> wrote:
> What I really need is to get some data back from the Service, once the
> stopService() is called.

I would not recommend that.

> SharedPreferences is being used for this.

I would not recommend that.

> I am updating the data from Service only in the onDestroy().

I would not recommend that.

Step #1: Replace your stopService() calls with something else (e.g.,
startService() with a particular Intent indicating it is time for the
service to stop) that passes control to the service.

Step #2: Do your "get some data back from the Service" logic in the
service as a result of Step #1, though I would recommend you use a
better data store (e.g., database).

Step #3: Have your service call stopSelf() after doing the work from Step #2.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to