implemented onCreate, onResume, and onPause in main activity