Question

I would like to know as to what will happen to the thread which has been created by an activity and the device is rotated. I have observed that the onDestroy method is called when this happens. Will the thread be killed too?

If the thread is not killed, how can I reassociate the thread with the activity as a new instance of the activity is created on rotation.

Thanks,

Lakshmie

Was it helpful?

Solution

The thread is not killed. You can keep a reference to your thread by overriding onRetainNonConfigurationInstance() to save the thread object and then getLastNonConfigurationInstance() to get it back.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top