Created
January 26, 2021 22:53
-
-
Save amsterdatech/1da93b6a7fd4ebb17817808d6f20f23d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
log("onCreate()") | |
super.onCreate(savedInstanceState) | |
} | |
override fun onStart() { | |
log("onStart()") | |
super.onStart() | |
} | |
override fun onResume() { | |
log("onResume()") | |
super.onResume() | |
} | |
override fun onPause() { | |
log("onPause()") | |
super.onPause() | |
} | |
override fun onStop() { | |
log("onStop()") | |
super.onStop() | |
} | |
override fun onDestroy() { | |
log("onDestroy()") | |
super.onDestroy() | |
} | |
private fun log(lifecycle: String) { | |
Log.d("Lifecycle", "${this.javaClass.simpleName} $lifecycle in ${this.javaClass.`package`?.name}") // Then send to analytics | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment