public static void runExample(
      AdManagerServices adManagerServices, AdManagerSession session, int activityId)
      throws RemoteException {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        adManagerServices.get(session, ActivityServiceInterface.class);

    // Create a statement to only select a single activity by ID.
    StatementBuilder statementBuilder =
        new StatementBuilder()
            .where("id = :id")
            .orderBy("id ASC")
            .limit(1)
            .withBindVariableValue("id", activityId);

    // Get the activity.
    ActivityPage page = activityService.getActivitiesByStatement(statementBuilder.toStatement());

    // Get the activity.
    Activity activity = Iterables.getOnlyElement(Arrays.asList(page.getResults()));

    // Update the expected URL.
    activity.setExpectedURL("http://google.com");

    // Update the activity on the server.
    Activity[] activities = activityService.updateActivities(new Activity[] {activity});

    for (Activity updatedActivity : activities) {
      System.out.printf(
          "Activity with ID %d and name '%s' was updated.%n",
          updatedActivity.getId(), updatedActivity.getName());
    }
  }
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , int activityId ) throws RemoteException { ActivityServiceInterface activityService = adManagerServices . get ( session , ActivityServiceInterface . class ) ; StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "id = :id" ) . orderBy ( "id ASC" ) . limit ( 1 ) . withBindVariableValue ( "id" , activityId ) ; ActivityPage page = activityService . getActivitiesByStatement ( statementBuilder . toStatement ( ) ) ; Activity activity = Iterables . getOnlyElement ( Arrays . asList ( page . getResults ( ) ) ) ; activity . setExpectedURL ( "http://google.com" ) ; Activity [ ] activities = activityService . updateActivities ( new Activity [ ] { activity } ) ; for ( Activity updatedActivity : activities ) { System . out . printf ( "Activity with ID %d and name '%s' was updated.%n" , updatedActivity . getId ( ) , updatedActivity . getName ( ) ) ; } }
Runs the example.

@param adManagerServices the services factory.
@param session the session.
@param activityId the ID of the activity to update.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.