最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在Android中 獲取正在運行的Service 實例

 更新時間:2013年04月19日 16:15:21   作者:  
本篇文章小編為大家介紹,在Android中 獲取正在運行的Service 實例。需要的朋友參考下
public class ServiceList extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		TextView tv = new TextView(this);
ActivityManager activityManger = (ActivityManager) getSystemService(ACTIVITY_SERVICE);// 獲取Activity管理器 List<ActivityManager.RunningServiceInfo> serviceList = activityManger.getRunningServices(30);// 從窗口管理器中獲取正在運行的Service tv.setText(getServicesName(serviceList)); setContentView(tv); } private boolean ServiceIsStart(List<ActivityManager.RunningServiceInfo> list, String className) {// 判斷某個服務(wù)是否啟動 for (int i = 0; i < list.size(); i++) { if (className.equals(list.get(i).service.getClassName())) return true; } return false; } private String getServicesName(List<ActivityManager.RunningServiceInfo> list) {// 獲取所有服務(wù)的名稱 String res = ""; for (int i = 0; i < list.size(); i++) { res += list.get(i).service.getClassName() + "/n"; } return res; } }

相關(guān)文章

最新評論

宜春市| 遵义市| 迁安市| 扎兰屯市| 手游| 永修县| 海口市| 静宁县| 颍上县| 仁寿县| 德惠市| 浦江县| 福建省| 河源市| 渭南市| 宣化县| 张家川| 塘沽区| 吉木乃县| 嵊泗县| 青铜峡市| 房产| 静安区| 金山区| 闽清县| 西贡区| 金阳县| 颍上县| 平武县| 尚志市| 从化市| 鸡西市| 安顺市| 盘锦市| 汕尾市| 恭城| 饶平县| 宣化县| 吉水县| 彝良县| 普洱|