SurfaceTexture methods are not always called Android 7.0

I have a TextureView in my code on which I set the SurfaceTextureListener .

On Android 6.0, the onSurfaceTextureDestroyed and onSurfaceTextureAvailable are called whenever I leave the activity and return (respectively), while on Android 7.0 I notice that onSurfaceTextureAvailable is called only once after the Activity is created.

The surface is not destroyed and is recreated whenever I leave activity and return, as I'm used to Android 6.0.

After some investigation, I noticed that APIs 18,19,24 behave in one direction and APIs 20-23 behave in a different way.

Any idea why and basically how to make it behave the same on all versions of Android?

+7
android android-7.0-nougat textureview
source share
1 answer

I came across the same, but I solved the problem by adding below in the manifest

 android:hardwareAccelerated="true" 
0
source share

All Articles