Okay, so I figured out what the problem with a series of back-and-
forth emails with blindfold.
Basically, the camera API is asynchronous to the point where my
setting the parameters on onSurfaceChanged() is not actually
occurring as it should be. In short, you need to have something that
will definitely complete, and a method that calls startPreview()
doesn't guarantee that at all. So in a series of emails, the idea
came up to monitor the preview frames, set up through locking a thread
on a boolean. I had a few issues with synchronization and the phone
locking up (Although I think I broke the Camera hardware itself when I
was doing so), but got around it by making a Camera.Shutter callback,
which takes care of the "method needs to complete" problem on top of
being fairly easily to do (by doing the following):
====
private Camera.ShutterCallback sillyDelay = new Camera.ShutterCallback
() {
public void onShutter() {
Camera.Parameters p = mCamera.getParameters();
p.setPictureSize(CAM_W, CAM_H);
p.setPictureFormat(PixelFormat.JPEG);
mCamera.setParameters(p);
}
};
====
@Override
public boolean onKeyDown(int keycode, KeyEvent event){
if (keycode == KeyEvent.KEYCODE_CAMERA ||
keycode == KeyEvent.KEYCODE_DPAD_CENTER) {
mCamera.takePicture(sillyDelay, null, writeMe);
}
super.onKeyDown(keycode, event);
return true;
}
====
On Nov 14, 7:08 am, blindfold <[EMAIL PROTECTED]> wrote:
> Hi Alvin,
>
> I will send you a test program to see if setPictureSize(480,320) also
> fails for me. I don't think you need the parameter.set() method unless
> you want to do additional things like setting JPEG quality below 100.
>
> Regards
>
> On Nov 14, 2:41 pm, Alvin Yates <[EMAIL PROTECTED]> wrote:
>
> > I read that, but it seems that I would have to use the "hidden"
> > parameter.set() methods in order to get that functionality, which is
> > not documented by the API and therefore leaves me hesitant to write it
> > in at the moment.
>
> > The code I am using is based on the Camera.Parameters.setPictureSize
> > (), which appears to do absolutely nothing.
>
> > At the moment, the only thing I can do is set the compression to JPG
> > and send the full 3.1M over the wire, which is causing some issues for
> > the server since it's attempting to do image processing on what it
> > assumes to be much smaller images.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---