views:

47

answers:

1

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

+2  A: 

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.

CaseyB
Thanks a lot Casey!
Lakshmie