in my Activity, i want to take a picture with android.hardware.Camera.
The code (see below) works fine in my AVD, but it doesn’t work on my Android phone – all I get is “Error -1”.
AVD:
Target: Android 2.3.3
SD Card: 64 MB
WVGA800
Phone:
Samsung Galaxy S2 with Android 2.3.6
Code:
android.hardware.Camera camera = Camera.open();
camera.takePicture(null, null, mPictureCallback);
camera.stopPreview();
camera.setPreviewCallback(null);
camera.release();
camera = null;
Manifest:
uses-feature android:name="android.hardware.camera"
uses-permission android:name="android.permission.CAMERA"
I don’t think that the PictureCallback matters – when I comment everything in the onPictureTaken method, the same error is returned.
Also, I have restarted my phone, tried setting a few Camera parameters etc. – but nothing helps.
I can’t find this specific error code for the Camera either.
Thanks in advance!
Without a correct assigned SurfaceView it will not work.
Even the SurfaceView must have a minimum size.