OnPause and OnResume methods called when pausing.