Android实现从activity中停止Service的方法
Android实现从activity中停止Service的方法
发布时间:2016-12-28 来源:查字典编辑
摘要:本文实例讲述了Android实现从activity中停止Service的方法。分享给大家供大家参考,具体如下:1、在AndroidManif...

本文实例讲述了Android实现从activity中停止Service的方法。分享给大家供大家参考,具体如下:

1、在AndroidManifest.xml注册Service

<service android:name=".service.SensorService" > <intent-filter> <action android:name="ITOP.MOBILE.SIMPLE.SERVICE.SENSORSERVICE"/> </intent-filter> </service>

2、在Activity中调用

final Intent intent = new Intent(); intent.setAction("ITOP.MOBILE.SIMPLE.SERVICE.SENSORSERVICE"); stopService(intent);

希望本文所述对大家Android程序设计有所帮助。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新安卓软件开发学习
热门安卓软件开发学习
编程开发子分类