从活动将数据发送到运行服务 [英] Send data from activity to running service

查看:183
本文介绍了从活动将数据发送到运行服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简短的问题。我怎样才能将数据从一个活动到正在运行的服务?

I have a short question. How can I send data from an activity to an already running service?

该方法是如下,我有一个服务在后台运行,这是开始,这只是显示一个输入窗口,一个新的活动。现在我想的类型的数据发送回服务。如何才能做到这一点?

The approach is as following, I have a service running in the background, which is starting a new activity that is just showing an input window. And now I want to send the typed data back to the service. How can this be done?

在此先感谢您的帮助! 诚挚的问候 托比

Thanks in advance for helping! Best regards Tobi

推荐答案

您知道<一个href="http://developer.android.com/reference/android/app/Service.html#onBind%28android.content.Intent%29"相对=nofollow> onBind 方法服务类?

这篇关于从活动将数据发送到运行服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆