public void finishActivity(Activity activity){
  if (mActivityStack != null && activity != null) {
    mActivityStack.remove(activity);
    activity.finish();
  }
}

public void finishActivity ( Activity activity ) { if ( mActivityStack != null && activity != null ) { mActivityStack . remove ( activity ) ; activity . finish ( ) ; } }
finish the given activity .
