2

拍照时如何启用快门声音?我已经尝试过了,但它不起作用!我正在 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);
    }
};
4

1 回答 1

7

您应该设置 not null 回调

        camera.takePicture(
                new Camera.ShutterCallback() { @Override public void onShutter() { } },
                new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { } },
                jpegCallback);
于 2014-07-11T10:06:53.310 回答