added lifecycle callbacks to save survey state when exiting an activity