0

I have some problem when I try to develop my app with Htc devices.

When i open the camera, it put a white image at the bottom of my app. As you can see in the image, only i can use the camera with the half.

enter image description here

Anyone know how can I solve this problem? Any trick with HTC Devices?

Thank you.

Code:

OnCreate()

    mHolder = getHolder();
    mHolder.addCallback(this);
    mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

and

 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

    if (mCamera != null) {
        Camera.Parameters parameters = Reader.getBestCameraParameters( mCamera.getParameters() );

        mCamera.setParameters(parameters);

        try {
            mCamera.setPreviewDisplay(holder);
        } catch (IOException e) {
            e.printStackTrace();
        }

        mPreviewSize = parameters.getPreviewSize();

        //Start camera preview
        mCamera.startPreview();
        mCamera.setPreviewCallback(mPreviewFrames);

    }


}

Solution: I have fixed the camera with one property. I put this, inside the activity of the camera in the manifest.

android:hardwareAccelerated="false"
fr4n
  • 755
  • 1
  • 8
  • 16

1 Answers1

0

First of all

Where is your sarfaceView are you using it from xml file if yes then make sure your sarfaceView has the width and height properties like this

 <android.view.SurfaceView
    android:id="@+id/preview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
Farrukh
  • 259
  • 2
  • 5
  • 15
  • Nothing, it's very strange because when i open the camera, the camera appears well, but after one-two seconds more or less the lower half of the view turn into white and only i can use the camera with the upper half. – fr4n Jun 14 '13 at 11:59