在Android 7/8中未调用onSurfaceTextureDestroyed,SurfaceTexture.setDefaultBufferSize在重新打开活动后无效

时间:2018-09-25 11:26:02

标签: android surface textureview

为什么在活动变得不可见(调用了Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("smb://192.168.200.228")); intent.putExtra("smb_username", "ABC"); intent.putExtra("smb_password", "xxx"); intent.putExtra("remote_folder", "/yourshare/folder"); //activity start startActivityForResult(intent, BROWSE_REQUEST); onSurfaceTextureDestroyed的Android 7和8中没有调用onPause

要解决“相机预览”尺寸大于或小于onStopTextureView帧填充的问题,我使用TextureView's TextureView's

但是在活动变得不可见(SurfaceTexture.setDefaultBufferSize(cameraWidth, cameraHeight)onPause)并且没有调用onStop之后,我尝试回到活动(onSurfaceTextureDestroyedonResume )框架不再适合TextureView的大小,我尝试再次调用onStart,但它没有任何效果(框架不会充满全视图),直到稍后我调用此方法为止:

SurfaceTexture.setDefaultBufferSize(cameraWidth, cameraHeight)

因此在onPause,onStop期间不会调用public void onStart() { mTextureView.postDelayed(() -> { mTextureView.getSurfaceTexture().setDefaultBufferSize(cameraWidth, cameraHeight); }, 2000); }

onSurfaceTextureDestroyed仅在onCreate,onStart,onResume之后被调用一次,但是在活动重新打开(onPause,onStop,onStart,onResume)之后才被调用,因为纹理没有被破坏。...

onSurfaceTextureAvailable

0 个答案:

没有答案