Skip to content Skip to sidebar Skip to footer

Killprocess Can Be Used In Some Cases?

I have a logout button in my activity. In my case the killProcess do what I want to do instead of the finish(), but is it a good idea to use killProcess? I have read that is better

Solution 1:

Calling killProcess stops the process immediately. There is no way for your app to prevent this or prepare for it. However, when you call finish you app is notified and is given a chance to release system resources, save states, etc. Using finish is the recommended and preferred way to shut things down. To use killProcess would be considered hackish and bad style.

If you are having problems with finish() closing the app fast enough you should consider overloading that method.

Post a Comment for "Killprocess Can Be Used In Some Cases?"