开发者

When does surfaceDestroyed() occur

开发者 https://www.devze.com 2023-02-24 00:40 出处:网络
I\'m having trouble figuring out when surfaceDestroyed() occu开发者_运维技巧rs. I am trying to make my threads stop running in the surfaceDestroyed() method (of a SurfaceView) but it appears that my s

I'm having trouble figuring out when surfaceDestroyed() occu开发者_运维技巧rs. I am trying to make my threads stop running in the surfaceDestroyed() method (of a SurfaceView) but it appears that my surface is never actually destroyed...can someone tell me when this happens? Or how to trigger it?


Whenever you click return or home button and leave the activity you get:

Activity onPause

surfaceDestroyed

and finally activity onDestroyed.

When you return the surfaceView is recreated, however if you have been using static variables do drive the application, they will be often preserved and it may only seem like surfaceView was not destroyed.

Regarding closing the thread, check this: Android crash when app is closed and reopened


surfaceDestroyed() is not called when the view is managed by a TabHost.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号