Home button in Android studio with kotlin

192 Views Asked by At

I have created a splash screen for my app in Android studio using kotlin. When the home button is pressed in splash screen time, the app restarts and opens the next activity i.e login activity instead of putting the app to background.

How can I put the app into background and avoid it to restart automatically when home button is pressed in splash screen time

1

There are 1 best solutions below

1
İbrahim Uyar On

Can you add this code to your splash screen activity?

override fun onPause() {
    super.onPause()
    finish()
}

I hope this helps.