Android: Camera giving blank pictures
<p>This is my code to take pictures in Android. But, it always return a blank image. What might be the error? I saw a few issues of setting the flash, exposure and focus mode which I set in my code but still the camera returns a blank image even though the photo gets taken.(Atleast I heard the sound of the aperture.)</p>

<pre><code>C

amera.Parameters p = camera.getParameters();
            List&lt;Size&gt; sizes = p.getSupportedPictureSizes();
            // Choose any one you want among sizes
            Size size = sizes.get(0);
            p.setPictureSize(size.width, size.height);

            p.set("flash-mode","off");
            p.set("focus-mode","auto");
            p.setExposureCompensation(100);
            p.setFocusMode("auto");
            camera.setParameters(p);
            camera.startPreview();
            camera.takePicture(shutterCallback, rawCallback,
                    jpegCallback);

ShutterCallback shutterCallback = new ShutterCallback() {
        public void onShutter() {
            Log.d(TAG, "onShutter'd");
        }
    };

    /** Handles data for raw picture */
    PictureCallback rawCallback = new PictureCallback() {
        public void onPictureTaken(byte[] data, Camera camera) {
            Log.d(TAG, "onPictureTaken - raw");
        }
    };

    /** Handles data for jpeg picture */
    PictureCallback jpegCallback = new PictureCallback() {
        public void onPictureTaken(byte[] data, Camera camera) {
            FileOutputStream outStream = null;
            try {
                // write to local sandbox file system
                // outStream =
                // CameraDemo.this.openFileOutput(String.format("%d.jpg",
                // System.currentTimeMillis()), 0);
                // Or write to sdcard
                outStream = new FileOutputStream(String.format(
                        "/sdcard/%d.jpg", System.currentTimeMillis()));
                outStream.write(data);
                outStream.close();
                Log.d(TAG, "onPictureTaken - wrote bytes: " + data.length);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
            }
            Log.d(TAG, "onPictureTaken - jpeg");
        }
    };
    @Override
    public void draw(Canvas canvas) {
        super.draw(canvas);
        Paint p = new Paint(Color.RED);
        Log.d(TAG, "draw");
        canvas.drawText("PREVIEW", canvas.getWidth() / 2,
                canvas.getHeight() / 2, p);
    }
</code></pre>
