I'm taking an Android Studio class, and the teacher taught me to do
Log.i("data", "onCreate called")
in the overriden methods. I just don't understand why.
This is the code of the whole thing:
package com.myfirstapplication.theclass4
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Log.i("data", "onCreate called") //Log turns red -> Alt+Enter
}
override fun onStart() {
super.onStart()
Log.i("data", "onStart called")
}
override fun onResume() {
super.onResume()
Log.i("data", "onResume called")
}
override fun onPause() {
super.onPause()
Log.i("data", "onPause called")
}
override fun onStop() {
super.onStop()
Log.i("data", "onStop called")
}
override fun onDestroy() {
super.onDestroy()
Log.i("data", "onDestroy called")
}
}