ACTIVITY_MAIN.XML: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ACTIVITY LIFE CYCLE DEMO" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.5" /> </androidx.constraintlayout.widget.ConstraintLayout> MAINACTIVITY.kt package com.example.myapp_activitylifecyclemethods import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.Toast class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) Toast.makeText(applicationContext,"ONCREATE() CALLED",Toast.LENGTH_SHORT).show() } override fun onStart() { super.onStart() Toast.makeText(applicationContext,"ONSTART() CALLED",Toast.LENGTH_SHORT).show() } override fun onRestart() { super.onRestart() Toast.makeText(applicationContext,"ONRESTART() CALLED",Toast.LENGTH_SHORT).show() } override fun onResume() { super.onResume() Toast.makeText(applicationContext,"ONRESUME() CALLED",Toast.LENGTH_SHORT).show() } override fun onPause() { super.onPause() Toast.makeText(applicationContext,"ONPAUSE() CALLED",Toast.LENGTH_SHORT).show() } override fun onStop() { super.onStop() Toast.makeText(applicationContext,"ONSTOP() CALLED",Toast.LENGTH_SHORT).show() } override fun onDestroy() { super.onDestroy() Toast.makeText(applicationContext,"ONDESTROY() CALLED",Toast.LENGTH_SHORT).show() } }