So I'm trying to use face detection with a camera, so I need to convert the byte array supplied to the preview callback, into a bitmap, using this code:
Camera.PreviewCallback previewCallback=new Camera.PreviewCallback()
{
    @Override
    public void onPreviewFrame(byte[] data, Camera camera) 
    {
        BitmapFactory.Options options = new BitmapFactory.Options();
        Bitmap mBitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options);
        if(mBitmap==null) faceDetected=false;
        else              faceDetected=(findFace(mBitmap)!=null);            
    }
};
Unfortunately, mBitmap is always null, and options outHeight and outWidth are always -1 - which indicates a decode error. Naturally, there are no diagnostics, so it's impossible to fix.