Home » Android » multithreading – how to kill all background process when an activity is closed in android-Exceptionshub

multithreading – how to kill all background process when an activity is closed in android-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

in my activity i have some process working in background .Sometimes it wont be finished when the activity is closed, which makes delay in rest of activities.Can we close all the background process when we close an activity.

How to&Answers:

There is lifecycle callback onDestroy() in activity, you can put all cleanup logic there.