如何从 IntentService 收集信息并更新 Android UI
我正在学习 Android,但我一直在使用我的服务。
我的应用程序每 X 秒通过 Socket 连接到我的服务器,接收 XML,解析信息并将其显示在 TextView 中。
我想知道如何实现 IntenService 来执行此操作以及如何将信息传递给 UI。我发现很难看到好的例子。
我很感激你能给我的任何帮助。
谢谢你!
I'm learning Android and I'm stuck with my service.
My application connects via Socket to my server every X seconds, receives an XML, parses the information and it's shows in a TextView.
I'd like to know how can I implement an IntenService to do this and how to communicate the info to the UI. I'm finding very hard to see good examples.
I appreciate any help you can give me.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用处理程序并从 IntentService
Parent Activity 向父 Activity 发送消息:
声明处理程序
调用 IntentService:
在 IntentService 内部:
Use a handler and send a message to parent activity from the intentservice
Parent Activity :
Declaring Handler
Invoking the intentservice:
Inside IntentService: