문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top