我已经成功地在Android中使用相机拍摄了单张照片。但是当我尝试一次性拍摄5张照片时,应用程序会停止响应,相机预览变成绿色,并且没有图片被保存。在堆栈跟踪中我看到的部分信息如下:
03-17 14:19:54.804: INFO/QualcommCameraHardware(19268): deinitPreview E 03-17 14:19:54.804: INFO/QualcommCameraHardware(19268): deinitPreview X 03-17 14:19:54.804: DEBUG/QualcommCameraHardware(19268): frame_thread X 03-17 14:19:54.834: DEBUG/QualcommCameraHardware(19268): snapshot_thread E 03-17 14:19:54.854: DEBUG/CameraService(19268): takePicture (pid 20509) 03-17 14:19:54.884: WARN/AudioFlinger(19268): write blocked for 85 msecs 03-17 14:19:55.154: DEBUG/CameraService(19268): postShutter 03-17 14:19:55.284: DEBUG/CameraService(19268): postRaw 03-17 14:19:55.314: DEBUG/QualcommCameraHardware(19268): snapshot_thread X 03-17 14:19:55.344: DEBUG/QualcommCameraHardware(19268): snapshot_thread E 03-17 14:19:55.364: DEBUG/CameraService(19268): takePicture (pid 20509) 03-17 14:19:55.984: DEBUG/CameraService(19268): postShutter 03-17 14:19:56.064: DEBUG/CameraService(19268): postRaw 03-17 14:19:56.074: ERROR/QualcommCameraHardware(19268): native_jpeg_encode: jpeg_encoder_encode failed. 03-17 14:19:56.074: ERROR/QualcommCameraHardware(19268): jpeg encoding failed 03-17 14:19:56.084: DEBUG/QualcommCameraHardware(19268): snapshot_thread X 03-17 14:19:56.154: INFO/DEBUG(19267): * ** * ** * ** * 03-17 14:19:56.164: INFO/DEBUG(19267): Build fingerprint: 'google_ion/google_ion/sapphire/sapphire:1.6/DRC83/14721:user/adp,test-keys' 03-17 14:19:56.164: INFO/DEBUG(19267): pid: 19268, tid: 20813 >>> /system/bin/mediaserver ... ... ... 14:19:59.894: INFO/ServiceManager(46): service 'media.camera' died 03-17 14:19:59.894: WARN/Camera(20509): Camera server died! 03-17 14:19:59.894: WARN/Camera(20509): ICamera died 03-17 14:19:59.894: ERROR/Camera(20509): Error 100 03-17 14:19:59.915: WARN/AudioSystem(71): AudioFlinger server died! 03-17 14:20:00.014: INFO/Process(71): Sending signal. PID: 18636 SIG: 3 03-17 14:20:00.054: INFO/dalvikvm(18636): threadid=7: reacting to signal 3我正在使用循环调用takePicture
方法来拍摄多张照片;
for(int m = 0 ; m < 6; m++) {
mPrimCamera.takePicture(null, mPictureCallbackMet, mPictureCallbackMet);
}
我正在使用运行Android 1.6的HTC Magic,尝试拍摄多张照片。我认为,我使用的方法不正确。使用Android Camera API拍摄多张照片的正确方法是什么?