[英]sending data from activity to Intentservice
my needs is to send data from activity to IntentService 我的需求是将数据从活动发送到IntentService
(from class that extends activity, to class that extends IntentService) (从扩展活动的类到扩展IntentService的类)
i successed to send to sample service, by using BroadcastReciver, but i want to extend IntentService class and not service 我成功通过使用BroadcastReciver发送到示例服务,但我想扩展IntentService类而不是服务
someone know how can i do that? 有人知道我该怎么办?
from 从
public class MainActivity extends Activity { ... } 公共类MainActivity扩展Activity {...}
to 至
public class MyIntentService extends IntentService { ... } 公共类MyIntentService扩展了IntentService {...}
Put the data in an Intent
extra that you use with the startService()
call to start your IntentService
. 将数据放入与startService()
调用一起使用的Intent
extra中以启动IntentService
。 Then, the IntentService
can read that extra in onHandleIntent()
. 然后, IntentService
可以在onHandleIntent()
读取额外的onHandleIntent()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.