拍摄照片时如何启用快门声?我试过这个,但它不起作用!我在Galaxy y上测试它(目标2.3.6) 任何提示或想法? 提前谢谢。
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
mCamera.takePicture(shutterCallback, null, mPicture);
return super.onTouchEvent(event);
}
private final ShutterCallback shutterCallback = new ShutterCallback() {
public void onShutter() {
AudioManager mgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mgr.playSoundEffect(AudioManager.FLAG_PLAY_SOUND);
}
};
答案 0 :(得分:7)
您应该设置非空回调
camera.takePicture(
new Camera.ShutterCallback() { @Override public void onShutter() { } },
new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { } },
jpegCallback);