简体   繁体   中英

onSurfaceTextureDestroyed is not called even when activity is destroyed

I have a Texture View , For which i have set setSurfaceTextureListener . I use this texture view to show live camera feed in my app. I am handling BACK KEY in app explicitly . On BACK KEY press i call " finish() " method to destroy my activity . The " onDestroy " Method of the activity gets called .

But the " onSurfaceTextureDestroyed " method which i have set on my texture View does not get called . I am not sure if it's OK to link this problem with android version But , Interestingly " onSurfaceTextureDestroyed " gets called when i use my app on KITKAT . Its giving problem on Jelly Beans.

Also As i check , When i press HOME Key :- On jelly bean onPause and onStop gets called . But On KITKAT onPause and onStop and onDestroy all three gets called.

I want to know why " onSurfaceTextureDestroyed " is not called even when activity's " onDestroy " is called .

I got the issue . I was setting the setSurfaceTextureListener to null on activity Ondestroy . Thats why it was not being called.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM