当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Sending Messages from my Service to my Activity?

问题描述:

I have an Android Service which copies files to an ftp server.

While it is doing that, I want to send feedback to my Activity so the user knows what happens.

I tried implementing it using the RemoteMessengerServiceSample code, but I have a problem ... All messages I send during the ftp transfer arrive at my Activity the moment the copy operation is finished ... not message by message while the copy job runs as I would like.

Is there any way to fix this? Maybe i'm using the wrong method for sending messages to my activity?

网友答案:

Try issuing a Broadcast it's much more simpler than implementing the service<-->activity binding.

This will help you for the activity side how can I notify a running activity from a broadcast receiver?

分享给朋友:
您可能感兴趣的文章:
随机阅读: