i have a service which fetches some data from network.i am sending data downl开发者_C百科oad finish type of messages through messenger object like this
messangerClient.send(Message.obtain(null, MyActivity.DOWNLOAD_SUCESS));
and getting it in my activity successfully.But now i need to send data from my service to my activity.I cannot use Parcel framework because it is supported from 2.2.So i am thinking to send it via setData() using bundle.But i am unable to figure out how to do this.
Please anybody have any idea to how to do this. Thanks
if you are binding to the service, in the service connection callback, you will receive the IBinder object, use that and fetch your service object and you can call methods on it like a normal object methods
look at the way LocalService object is captured in the example mentioned in android documentation
If you are starting the activity from your service then you can pass data thru Intent.
精彩评论