// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the ActivityService.
ActivityServiceInterface activityService =
user.getService(DfpService.V201302.ACTIVITY_SERVICE);
// Set the ID of the activity to update.
Integer activityId = Integer.parseInt("INSERT_ACTIVITY_ID_HERE");
// 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());