Hi, I have got a bunch of questions why image capture does not work
with the trackball click on HTC Magic. Here is the code, which works
on G1 phone
private FocusCameraListener1 focusCameraListener1 = new
FocusCameraListener1();
private FocusCameraListener2 focusCameraListener2 = new
FocusCameraListener2();
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (inited) {
if (event.getRepeatCount() < 2) {
if (keyCode == KeyEvent.KEYCODE_FOCUS) {
camera.autoFocus(focusCameraListener1);
return true;
} else if (keyCode == KeyEvent.KEYCODE_CAMERA
|| keyCode ==
KeyEvent.KEYCODE_DPAD_CENTER) {
inited = false;
if (focused) {
capture();
} else {
camera.autoFocus(focusCameraListener2);
}
return true;
}
}
}
return super.onKeyDown(keyCode, event);
}
private class FocusCameraListener1 implements ICameraListener {
@Override
public void onPictureTaken(final byte[] data) {
}
@Override
public void onAutoFocus(final boolean success) {
if (success) {
afView.setImageResource(R.drawable.af);
focused = true;
} else {
afView.setImageBitmap(null);
focused = false;
}
}
}
private class FocusCameraListener2 implements ICameraListener {
@Override
public void onPictureTaken(final byte[] data) {
}
@Override
public void onAutoFocus(final boolean success) {
if (success) {
capture();
}
}
}
Basically what I am trying to do is to use the autofocus feature
whenever possible (if the user pressed the focus key or if the user
pressed the camera key). Once the autofocus was completed successfully
the camera will capture an image.
I am out of ideas what could be wrong here, pls help
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---