private static final String ACTIVITY_ID = "INSERT_ACTIVITY_ID_HERE";
public static void runExample(DfpServices dfpServices, DfpSession session,
int activityId) throws Exception {
// Get the ActivityService.
ActivityServiceInterface activityService =
dfpServices.get(session, ActivityServiceInterface.class);
// Get the activity.
Activity activity = activityService.getActivity(activityId);
// 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());