Hey guys!

I try to write a camera app (with the old API because of kitkat) and i have 
1 problem. Colors are pushed to the right side. For example when i focus my 
red pen on a white paper, the pen itself is black/white and the red color 
is pushed some way to the right. There is also a green bar on the left side 
of the screen. Don“t know where it comes from.
Screenshot <http://de.tinypic.com/view.php?pic=1z5lyzo&s=9#.V4ZvBjVi79M>
My Code:
MainActivity

@Override protected void onCreate(Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState); 
  setContentView(R.layout.activity_main);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
  butCF = (Button) findViewById(R.id.cam_changeFlash); 
setCam(Camera.CameraInfo.CAMERA_FACING_BACK); } 
private void setCam(int i){ 
  cameraPreviewLayout = (FrameLayout)findViewById(R.id.camera_preview); 
  capturedImageHolder = (ImageView)findViewById(R.id.captured_image); 
  camera = checkDeviceCamera(i); params = camera.getParameters(); 
  params.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO); 
  params.setColorEffect(Camera.Parameters.EFFECT_NONE); 
  isfocusing=true; 
  camera.autoFocus(new Camera.AutoFocusCallback() { public void 
onAutoFocus(boolean success, Camera camera) { isfocusing=false;} }); 
  camera.setDisplayOrientation(90); 
  mImageSurfaceView = new ImageSurfaceView(MainActivity.this, camera); 
  cameraPreviewLayout.addView(mImageSurfaceView); Button captureButton = 
(Button)findViewById(R.id.button); 
  captureButton.setOnClickListener(new View.OnClickListener() { @Override 
public void onClick(View v) { camera.takePicture(null, null, pictureCallback); 
} }); 
  camera.setParameters(params); }
SurfaceView

public class ImageSurfaceView extends SurfaceView implements 
SurfaceHolder.Callback { 
private Camera camera; private SurfaceHolder surfaceHolder; 
public ImageSurfaceView(Context context, Camera camera) { 
  super(context); 
    this.camera = camera; 
    this.surfaceHolder = getHolder(); 
    this.surfaceHolder.addCallback(this); }
 @Override public void surfaceCreated(SurfaceHolder holder) { 
    try { 
  this.camera.setPreviewDisplay(holder); this.camera.startPreview(); } 
  catch (IOException e) { e.printStackTrace(); } }
@Override public void surfaceChanged(SurfaceHolder holder, int format, int 
width, int height) { } 
@Override public void surfaceDestroyed(SurfaceHolder holder) { 
this.camera.stopPreview(); this.camera.release(); } } 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/fe213d0c-d10d-49ec-bc85-fe47622b1667%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to