public boolean isTabAssociatedWithNonDestroyedActivity(boolean isIncognito,int tabId){
  List<WeakReference<Activity>> activities=ApplicationStatus.getRunningActivities();
  for (  WeakReference<Activity> ref : activities) {
    Activity activity=ref.get();
    if (activity != null && isValidActivity(isIncognito,activity.getIntent()) && getTabIdFromIntent(activity.getIntent()) == tabId && !isActivityDestroyed(activity)) {
      return true;
    }
  }
  return false;
}

public boolean isTabAssociatedWithNonDestroyedActivity ( boolean isIncognito , int tabId ) { List < WeakReference < Activity > > activities = ApplicationStatus . getRunningActivities ( ) ; for ( WeakReference < Activity > ref : activities ) { Activity activity = ref . get ( ) ; if ( activity != null && isValidActivity ( isIncognito , activity . getIntent ( ) ) && getTabIdFromIntent ( activity . getIntent ( ) ) == tabId && ! isActivityDestroyed ( activity ) ) { return true ; } } return false ; }
check if the tab is associated with an activity that hasn ' t been destroyed . this catches situations where a documentactivity is no longer listed in android ' s recents list , but is not dead yet .
