Reputation: 2769
I am capturing video using MediaRecorder. The part of the code is given below.
surfaceView = (SurfaceView) findViewById(R.id.surface_camera);
mCamera = Camera.open();
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
But surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
is deprecated. Is there any other methods instead of this method. I want to run my code in all versions.
Upvotes: 3
Views: 5518
Reputation: 2902
You can check the SDK version and only call SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS)
for older versions.
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
Upvotes: 4