欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實(shí)現(xiàn)從activity中停止Service的方法

 更新時(shí)間:2016年01月21日 09:36:48   作者:nosxcy  
這篇文章主要介紹了Android實(shí)現(xiàn)從activity中停止Service的方法,結(jié)合實(shí)例形式簡單分析了Android中Service的注冊、創(chuàng)建及使用stopService停止Service的方法,需要的朋友可以參考下

本文實(shí)例講述了Android實(shí)現(xiàn)從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中調(diào)用

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

更多關(guān)于Android開發(fā)相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開發(fā)入門與進(jìn)階教程

希望本文所述對大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論