当前位置:操作系统 > 安卓/Android >>

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 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,