I am working on an Android app which requires a lot of resources, for this reason I decided to add an Exit button even though it is discouraged, the usual practice is to let the systems handle it via the Back Button. The issue is that it doesn't work, at least on the emulator. The app closes the main View, goes in the background and keeps logging. The first time I tried to exit by calling finish(), then I tried by calling super.onBackPressed(), then both of them, but the result is always the same.
override fun onCreateOptionsMenu(item: MenuItem): Boolean {
when (item.itemId) {
R.id.exti_item -> {
finish()
super.onBackPressed()
}
}
}
Is it possible to close and app? I could leave it to the OS, but apart from the memory usage I'm worried it could drain the battery.