Programatically create field collection into Profile2 on new user creation
Fatal error: Call to a member function setHostEntity() on a non-object


The error means that you are trying to call setHostEntity() method on a non-object, in other words the $field_collection is not an object (NULL probably).

So please check one line before, which is:

$field_collection = entity_create('field_collection_item', array('field_name' =&gt; 'field_activities'));


So basically you are trying to load field_activities field collection, but it is not there, therefore your $field_collection is FALSE as per entity_create  API:


  Return value: A new instance of the entity type or FALSE if there is no information for the given entity type.


Therefore please make sure your field_activities exists as field collection (e.g. at /admin/structure/field-collections), or add additional failing scenario to your code, so when $field_collection is FALSE, do not execute further code.

For valid examples using field collections, check: Entity metadata wrappers page.