This is repeat code from the setActivity() function. We should probably move it out to a separate function - perhaps call it setActivityForViews()