Android学习之关闭应用程序的方法
Java代码
package com.close;
import java.util.LinkedList;
import java.util.Stack;
import android.app.Activity;
public class ActivityManager {
private static LinkedList<Activity> acys;
private static ActivityManager instance = null;
private ActivityManager (){}
public static ActivityManager getInstance(){
if(instance == null){
instance = new ActivityManager ();
acys = new LinkedList<Activity>();
}
return instance;
}
public void add(Activity acy)
{
acys.add(acy);
}
public void remove(Activity acy)
{
acys.remove(acy);
}
public void closeAll()
{
Activity acy;
while(acys.size() != 0)
{
acy = acys.poll();
if(!acy.isFinishing())
acy.finish();
}
}
}
补充:移动开发 , Android ,