Create a thread in the activity and stop that activity, then what will happen t o that thread, will it be alive or dead?

Answer: it will be alive, but its priority will be least compared to thread in a service.


Description:  once a thread is created, it will run independently of who has created until the work given to that thread is finished. but in case of low memory scenarios a thread created by activity and which is running in the background will have more susceptibility of being killed by android system. More worse is android can not recreate the thread which was killed because of low memory. but if that thread was in service, then chances of getting killed by android due to low memory may be less than previous situation. even if android system kills the thread, again it will start the service when memory resources are available and service can re-initiate that killed thread.

No comments:

Post a Comment