Thursday, May 14, 2009

android的相機功能

使用android 相機預覽功能需要幾個物件surfaceView , SurfaceHolder, Camera
surfaceView = (SurfaceView)findViewById(R.id.cameraView);
surfaceHoler = surfaceView.getHolder();
surfaceholder.addCallback(this);
surfaceHolder.setType();

Camera.Parameters parameters = camera.getParameters();
parameters.setPictureFormat(PixelFormat.JPEG);
parameters.setPreviewSize(320, 340);
parameters.setPictureSize(320,340);
camera.setParameters(parameters);
camera.setPreviewDisplay(surfaceHolder);

camera.startPreview();

No comments:

Post a Comment