Skip to content Skip to sidebar Skip to footer

Open Camera In A Blank Surfaceview

I am very new to android programming and All I want to do is open camera app in surface view so that I can open camera into it and set some parameters like following? Camera camera

Solution 1:

After camera.startPreview() you have to write preview.setCamera(camera) to set camera. preview is the object of your class which extends SurfaceView and implements SurfaceHolder.Callback.

camera.startPreview();
preview.setCamera(camera);

Solution 2:

Manifest should include the following:

<uses-permissionandroid:name="android.permission.CAMERA" /><uses-featureandroid:name="android.hardware.camera" /><uses-featureandroid:name="android.hardware.camera.autofocus" />

Have you added CameraSurfaceView to your layout? You can deploy it in your layout.xml or programmatically add it in onCreate() by layout.addView.

Post a Comment for "Open Camera In A Blank Surfaceview"