当前位置: 代码迷 >> Android >> android系统退出代码兑现
  详细解决方案

android系统退出代码兑现

热度:29   发布时间:2016-05-01 19:34:50.0
android系统退出代码实现
   android系统退出实现,代码如下:


package com.sms.util;import java.util.LinkedList;import java.util.List;import android.app.Activity;import android.app.Application;//实现Activity退出public class MyApplication extends Application{	private List<Activity> activityList = new LinkedList<Activity>();	private static MyApplication instance;		private MyApplication(){			}		//单例实现返回MyApplication实例	public static MyApplication getInstance(){		if(null == instance){			instance = new MyApplication();		}		return instance;	}		//Activity加入到List中	public void addActivity(Activity activity){		activityList.add(activity);	}		//遍历每个Activity退出	public void exit(){		for(Activity activity:activityList){			activity.finish();		}		System.exit(0);	}}
  相关解决方案