Update MainActivity.java

Added onPause and onResume calls