code: public Activity getMostRecentlyStartedActivity() {
          List<StartedActivity> activities = getStartedActivities();
  
          if (activities.size() == 0) {
              return null;
          }
  
          return activities.get(activities.size() - 1).getActivity();
      }
docs: Returns the most recently started {@link Activity}. In most cases, this
  will be the activity currently visible on screen.