Fix NullPointerException in addHeaderViewToActivity (closes #246)

Fix a NullPointerException to close #246.