public void addActivity(Activity activity){
  if (mActivityStack == null)   mActivityStack=new Stack<>();
  mActivityStack.add(activity);
}

public void addActivity ( Activity activity ) { if ( mActivityStack == null ) mActivityStack = new Stack < > ( ) ; mActivityStack . add ( activity ) ; }
add activity to the stack .
