Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - What happens to Threads when a Activity finishes?

I have an Activity, which starts a Thread to do some work. What happens if the user presses the Back button, or the UI thread calls finish() to the thread?

Will the activity wait for the thread to finish() before the activity is destroyed?

Does the thread complete its work after the activity gets destroyed?

like image 707
user1587021 Avatar asked Dec 17 '25 22:12

user1587021


1 Answers

Thread will do its work, but you can't use any callbacks to your activity.

like image 56
Alex Klimashevsky Avatar answered Dec 19 '25 16:12

Alex Klimashevsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!