您的位置:首页 > 其它

service的隐式启动和显示启动

2011-11-25 08:53 253 查看
隐式启动

<service android:name=".service">

<intent-filer>

<action android:name="com.android.service"/>

<intent-filer>

</service>

final Intent serviceIntent=new Intent();

serviceIntent.setAction("com.android.service");

显示启动

final Intent serviceIntent=new Intent(this,service.class);

startService(serviceIntent);

如果在同一个包中。两者都可以用。在不同包时。只能用隐式启动
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐