public void removeActivity(Activity activity){
  if (activityStack == null) {
    activityStack=new Stack<Activity>();
  }
  activityStack.remove(activity);
}

public void removeActivity ( Activity activity ) { if ( activityStack == null ) { activityStack = new Stack < Activity > ( ) ; } activityStack . remove ( activity ) ; }
remove activity from stack
