如何在Android上使用IntentService实现回调?

发布于 2024-09-27 13:36:53 字数 63 浏览 1 评论 0 原文

是否必须用AIDL来实现? 请提供一个例子,谢谢。

编辑: 有几种解决方案,有人知道哪个更好吗?

If it must implement with AIDL?
And please kindly provide an example, thanks.

EDIT:
There are several solutions, Does anyone know which is better?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬﹪忆之殇 2024-10-04 13:36:53

您可能正在寻找 ResultReceiver 类 (http:// /developer.android.com/reference/android/os/ResultReceiver.html)。

您扩展它,将其与您调用 Service 的意图一起传递(它是可打包的),然后当您的任务在 Service 中完成时,您调用 ResultReceiver 的 onReceiveResult() 方法处理结果。

You might be looking for the ResultReceiver class (http://developer.android.com/reference/android/os/ResultReceiver.html).

You extend it, pass it along with the intent you invoke the Service with (it's parcelable), then when your task completes in the Service, you call the ResultReceiver's onReceiveResult() method with the results.

染年凉城似染瑾 2024-10-04 13:36:53

查看这篇文章:在 Android 中使用 ResultReceiver ,讨论 resutlreceiver 的实现。

checkout this post :Using ResultReceiver in Android , discussing the implementation of resutlreceiver.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文