如何访问IntentService的队列?
我有一个活动将多个上传进程放入 IntentService 的队列中。现在我想显示待上传和已开始上传的列表,以及停止上传的按钮。
基于这个问题向 IntentService 询问有关其队列的信息我开始实现一个外部队列,但到目前为止我不知道如何停止特定任务。
有没有更好的方法来管理 IntentService 的队列?
I have an activity which puts several upload processes into the queue of an IntentService. Now i would like to show a list of the pending and started uploads, and a button to stop an upload.
based on this question Asking an IntentService for information about its queue i started to implement an external queue but so far i have no idea how to stop a specific task.
Are there any better ways how to manage the queue of an IntentService?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 IntentService 中注册一个 BroadCastReceiver("stopUpload") 以在收到此意图时停止上传。从您的活动的 sendBroadcast("stopUpload") 触发该意图。
Register a BroadCastReceiver("stopUpload") in your IntentService to stop uploading when this intent is received. Trigger that intent from your activity's sendBroadcast("stopUpload").
使用 Service 和 AsyncTasks 不是更好吗?
Aren't you better off with a Service and AsyncTasks ?