Code example for Stack

Methods: get, size

0
		Activity activity=activityStack.lastElement();
		return activity;
	} 
	 
	public Activity previousActivity(){
		int size = activityStack.size();
		if(size == 1 || size == 0){
			return currentActivity(); 
		} 
		Activity activity=activityStack.get(size-2);
		return activity;
	} 
 
	public void finishActivity(){ 
		Activity activity=activityStack.lastElement();
		finishActivity(activity);
	} 
 
	public void finishActivity(Activity activity){
		if(activity!=null){
			activityStack.remove(activity);