I encountered a strage thing when I use TextureView on my work. I implemented the 4 methods of SurfaceTextureListener:
onSurfaceTextureAvailable
onSurfaceTextureSizeChanged
onSurfaceTextureDestroyed
onSurfaceTextureUpdated
Doing such a thing is quite easy, it's unnecessary to paste my code.
There is no doubt that onSurfaceTextureAvailable will be called when the activity is started and onSurfaceTextureDestroyed will be called when the activity is destroyed.
But things changed in the case of foreground and backgroud switching.
For most devices, onSurfaceTextureAvailable and onSurfaceTextureDestroyed are not called during foreground and backgroud switching.
But for some devices such as Coolpad 8670 with android 4.4.2, onSurfaceTextureDestroyed is called when the activity go to backgroud and onSurfaceTextureAvailable is called when the activity return to foregroud.
I don't know why.
Is there a way of avoiding the calling of onSurfaceTextureDestroyed when activity go to background for all devices?