How to exit application

hi i’m very new to Kotlin dev and i would to know how to exit app in kotlin with a button it’s seem to be
simple i try to read doc but …

This is an Android app?

yes a kotlin app with just a mainActivity in android studio

My understanding that Android apps don’t “exit” themselves.

An app is closed by the Android O/S, either in response to a user action such as touching the back-arrow, or by the O/S closing the app to reclaim resources.

The app receives an event such as onStop() or onDestroy() so that it can do cleanup like saving data or releasing resources.

thanks for your answer .

I did find this article. Most of it is several years old, but there are some newer posts at the bottom:

i will try this thanks ,a question :you can’t use both language in the same files Android/Kotlin
: im using kotling as a complet beginners.

By both languages, do you mean Kotlin and Java?

Kotlin sir,