Wired up onResume and onPause methods.