Surely I cant be the only one to encounter problems with this?

On May 24, 6:19 pm, mscwd01 <[email protected]> wrote:
> Hey,
>
> This is my code I use to display a preview from the camera on a
> SurfaceView:
>
> public void surfaceChanged(SurfaceHolder holder, int format, int w,
> int h) {
>
>         Camera.Parameters parameters = mCamera.getParameters();
>         List<Size> cameraSizes =
> CameraReflect.getSupportedPreviewSizes(parameters);
>         if(cameraSizes != null && cameraSizes.size() > 0) {
>                 parameters.setPreviewSize(Math.max(cameraSizes.get(0).width,
> cameraSizes.get(0).height), Math.min(cameraSizes.get(0).width,
> cameraSizes.get(0).height));
>         }
>         else {
>                 parameters.setPreviewSize(Math.max(w, h), Math.min(w, h));
>         }
>         mCamera.setParameters(parameters);
>         mCamera.startPreview();
>
> }
>
> It's pretty basic stuff; it uses reflection to determine if the
> version of Android the user is running supports the
> getSupportedPreviewSizes() method. If it does it obtains the width and
> height and sets these as the preview size. If the version of Android
> is older it will just set it as the width and height returned by the
> SurfaceView.
>
> However, it seems the Motorola Droid/Milestone doesn't like this code
> and will instead show a blank screen instead of the camera preview.
>
> Could someone kindly tell me where i'm going wrong?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to