可以捆绑传递给服务? [英] Can a bundle be passed to a service?
本文介绍了可以捆绑传递给服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序需要从一个活动到服务中获得价值。我需要检索的值是一个我在活动点击。
In my application i need to get a value from an activity to a service. The value that i need to retrieve is the one i clicked in that activity.
有关例如:如果我从活动A选择X [I]的元素,我需要检索值x [i]于服务S.
For eg: If i select x[i] element from Activity A, i need to retrieve the value x[i] in a Service S.
这怎么可能?
谢谢,
尼基
推荐答案
在服务使用本:
public int onStartCommand (Intent intent, int flags, int startId)
{
super.onStartCommand(intent, flags, startId);
Bundle bundle = intent.getExtras();
}
这篇关于可以捆绑传递给服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文