There's a service which runs always and listens to some events, will push them into a log someday. I would like to display those events in the main actvity when it's running, but how to send the event details to the activity? You don't receive the intent itself, when you send it to the activity with Context.startActivity()
, so that you can't re开发者_C百科trive the data with Intent.getXxxExtra()
.
Issue a Broadcast from your Service and implement a private BroadcastReceiver in your activity.
Yes, you can use the Handler class for message passing between your Service and your main Activity.
精彩评论