Code example for Stack

Methods: push

0
 
	private void addActivityToStack(Activity activity){
		activitiesStoredInActivityStack.add(activity.toString());
		weakActivityReference = new WeakReference<Activity>(activity);
		activity = null;
		activityStack.push(weakActivityReference);
	} 
 
	/** 
	 * Waits for an activity to be started if one is not provided 
	 * by the constructor. 
	 */ 
 
	private final void waitForActivityIfNotAvailable(){ 
		if(activityStack.isEmpty() || activityStack.peek().get() == null){
 
			if (activityMonitor != null) {
				Activity activity = activityMonitor.getLastActivity();
				while (activity == null){
					sleeper.sleepMini();
					activity = activityMonitor.getLastActivity();