boolean isAppended = activity.addSlice(slice);
if (!isAppended) {
// The slice could not be added to the activity
// Clone the activity and make it match
// the time span of the slice
activity = (Activity) activity.clone();
activity.setStart(slice.getDate());
activity.setDuration(slice.getDuration());
activities.add(activity);
}
}