Android Question Activity.finish

Hamo

Member
Licensed User
Longtime User
Is there no way to completely terminate and close the app and remove it from memory when the user presses exit. I have tried exitapplication and activity.finish but the blooming thing still stays in memory until I go to settings, app manager and force stop. Occasionally the tablet freezes and I need to ensure it's not because the app still running in the background.
Thanks for any help.
Hamo
 
Last edited:

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hi,
You have to be sure to stop all services (StopService) related to your application, finish all activities (Activity.Finish) and after that only you call ExitApplication
 
Upvote 0

Hamo

Member
Licensed User
Longtime User
Hi,
You have to be sure to stop all services (StopService) related to your application, finish all activities (Activity.Finish) and after that only you call ExitApplication

Thanks, I'll try. No service modules in current application. Do I still need StopService ?
Hamo
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
No if there is no service, you don't have to stop any
 
Upvote 0

Hamo

Member
Licensed User
Longtime User
No, it doesn't work, I still have to go to settings, app manager, force stop to close the app completely.
This is the one single thing I hate about android. When I terminate an application I want it out, finished,
kaput, not still running. is there no way to do this without going to settings, app manager, force stop ?
Hamo
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
I am sorry but you talk about the "Force stop" button, right ? It is how it works. Look at other apps you haven't already started. On my phone they are working exactly like the way you are mentioning

finished, kaput, not still running
kidding: What about the use of a bazooka ?
 
Upvote 0

Hamo

Member
Licensed User
Longtime User
When I exit a program I want it to close, finish, disappear. I think it's stupid that it still runs in the background
using resources if nothing else. Who wants the engine still running after turning the key and getting out of the car ?
Hamo
 
Upvote 0

bsnqt

Active Member
Licensed User
Longtime User
When I exit a program I want it to close, finish, disappear. I think it's stupid that it still runs in the background
using resources if nothing else. Who wants the engine still running after turning the key and getting out of the car ?
Hamo

The engine will stop when the fuel is finished, don't worry too much
 
Upvote 0

Euxaes

Member
Licensed User
Longtime User
I stumped on the same issue as you have before when I started developing an android app. From what I learned and read around here it is not possible because it's the way Android was designed. This is a quote from one of the threads I've read before:

The process is kept in the background until the OS decides to kill it. -snipped-

If you want to read more you can check out these two threads I've bookmarked for reference:
Exit.Application and Activity.Finish
exitapplication ends the app?
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
When I exit a program I want it to close, finish, disappear. I think it's stupid that it still runs in the background
using resources if nothing else. Who wants the engine still running after turning the key and getting out of the car ?
Hamo
Why? It doesn't make sense.
In the background your app waste 0% cpu cycles (if no service is used). It sleeps and need only a little bit memory. And if your system runs into low memory, Android kills your app.
On the other hand, your app starts faster if it remains in the background.
 
Upvote 0

ivanthomson

Member
Licensed User
Longtime User
I agree with Hamo. The way Android handles exiting applications is annoying. I also do not like that Android keeps things in memory lingering. Android is not good at cleaning up memory... hence, why so many people are constantly in the APP settings pressing the FORCE quit buttons.

I consider this a design flaw in Android, that may have started out as a good idea for slow devices that took awhile to load resources and execute programs, but, on modern devices this is just an annoyance now.

The reason it becomes an annoyance is because Android will unload resources but not reset the FIRSTTIME flag, so when your app comes back to life, from a user running it again (thinking he is running it brand new again), it often can crash the app as the resources aren't there. So, the FirstTime flag is not reliable in my opinion, which kind of kills the reason for having a first time flag in the create subroutine.

This is why people want to kill off their apps, because it is the proper thing that should be done, but Android doesn't really allow it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…