我知道人们会抱怨以前曾经问过这个问题。我发布它的原因是我看不出我的不同,它不起作用。我花了两天多时间查看其他帖子,但我只是没有看到它。
预期行为: 我想启动相机,拍照,然后返回我发起的活动。
实际行为: 相机启动并允许我拍照,但之后它只给我重新拍照,取消照片和复选标记的选项。 当我按下复选标记时没有任何反应。它没有被冻结,但它不允许我说“是的我拍了照片,还给结果。”
进入我之前活动的唯一方法是按回或取消。如果我按重拍照片,它会返回图片模式并允许我拍摄另一张照片。
导致这种情况的原因是什么?
public void addPhotoEvent(View v) {
IMAGEID = ((View) ((View) v.getParent()).getParent()).getId();
holder = ((LinearLayout) ((View) v.getParent()).getParent());
updated = false;
Log.v(this.getClass().getSimpleName(), "Photo Event Launch");
File folder=new File(getFilesDir(),"RedMango");
File file = new File(folder,"photo"+IMAGEID+".PNG");
if(!file.exists())
{
file.mkdir();
}
Uri uri= Uri.fromFile(file);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(intent, REQUEST_CODE);
}
记录猫
12-31 14:44:34.084: V/Page(23779): Photo Event Launch
12-31 14:44:34.084: I/ActivityManager(394): START {act=android.media.action.IMAGE_CAPTURE cmp=com.android.gallery3d/com.android.camera.Camera (has extras) u=0} from pid 23779
12-31 14:44:34.104: V/Page(23779): Saving Notes
12-31 14:44:34.104: V/Database(23779): Database Connection Open
12-31 14:44:34.104: V/Database(23779): Database Closed
12-31 14:44:34.104: V/Page(23779): Saved Notes
12-31 14:44:34.134: V/CameraHolder(23692): open camera 0
12-31 14:44:34.134: I/CameraService(154): Opening camera 0
12-31 14:44:34.134: I/NvOmxCamera(154): HAL_camera_device_open: open camera 0
12-31 14:44:34.174: V/StateManager(23692): startState class com.android.gallery3d.app.PhotoPage
12-31 14:44:34.184: D/OrientationManager(23692): lock orientation to portrait
12-31 14:44:34.194: E/(154): ioctl SetWhiteBalance failed: -1
12-31 14:44:34.194: E/NvOmxCameraSettingsParser(154): Param type 70 not supported
12-31 14:44:34.194: I/NvOmxCamera(154): HAL_camera_device_open: opened camera 0 (0x41010198)
12-31 14:44:34.194: I/AwesomePlayer(154): setDataSource_l('/system/media/audio/ui/camera_click.ogg')
12-31 14:44:34.214: I/AwesomePlayer(154): setDataSource_l('/system/media/audio/ui/VideoRecord.ogg')
12-31 14:44:34.244: V/camera(23692): mSceneMode auto
12-31 14:44:34.254: V/camera(23692): Color effect value =none
12-31 14:44:34.254: V/camera(23692): autoExposure value =center
12-31 14:44:34.254: V/camera(23692): antiBanding value =60hz
12-31 14:44:34.254: D/CameraSettings(23692): Parameters: [antibanding-values=off,auto,50hz,60hz, antibanding=60hz, auto-exposure-lock-supported=true, auto-exposure-lock-values=false,true, auto-exposure-lock=false, auto-whitebalance-lock-supported=true, auto-whitebalance-lock-values=false,true, auto-whitebalance-lock=false, camera-mode=0, effect-values=mono,negative,none,posterize,sepia,aqua,solarize,nv-vivid,nv-emboss, effect=none, exposure-compensation-step=0.1, exposure-compensation=0, focal-length=2.080, focus-distances=0.95,1.9,Infinity, focus-mode-values=fixed, focus-mode=fixed, horizontal-view-angle=72.600, jpeg-quality=100, jpeg-thumbnail-height=240, jpeg-thumbnail-quality=90, jpeg-thumbnail-size-values=0x0,320x240, jpeg-thumbnail-width=320, max-exposure-compensation=20, max-num-detected-faces-hw=0, max-num-focus-areas=0, max-num-metering-areas=0, max-zoom=28, metering-areas=(0,0,0,0,0), min-exposure-compensation=-20, nv-flip-preview-values=off,vertical,horizontal,both, nv-flip-preview=off, nv-flip-still-values=off,vertical,horizontal,both, nv-flip-still=off, picture-format-values=jpeg,jfif,exif, picture-format=jpeg, picture-size-values=320x240,480x480,640x480,800x600,1024x768,1280x720,1280x960, picture-size=1280x720, preferred-preview-size-for-video=720x576, preview-format-values=yuv420p,yuv420sp, preview-format=yuv420sp, preview-fps-range-values=(4000,60000), preview-fps-range=4000,60000, preview-frame-rate-values=5,8,10,15,20,24,25,30, preview-frame-rate=30, preview-size-values=176x144,320x240,352x288,480x480,640x480,704x576,720x408,720x480,720x576,768x432,800x448,960x720,1280x720, preview-size=1280x720, recording-hint-values=false,true, recording-hint=false, rotation-values=0,90,180,270, rotation=0, smooth-zoom-supported=true, vertical-view-angle=72.600, video-frame-format-values=yuv420p, video-frame-format=yuv420p, video-size-values=40x30,176x144,320x240,352x288,640x480,704x576,720x480,720x576,768x432,1280x720, video-size=1280x720, video-snapshot-supported=true, video-stabilization-supported=false, video-stabilization-values=false,true, video-stabilization=false, whitebalance-values=auto,incandescent,fluorescent,daylight, whitebalance=auto, zoom-ratios=100,125,150,175,200,225,250,275,300,325,350,375,400,425,450,475,500,525,550,575,600,625,650,675,700,725,750,775,800, zoom-supported=true, zoom=0]
12-31 14:44:34.254: V/camera(23692): mSceneMode auto
12-31 14:44:34.264: V/camera(23692): Color effect value =none
12-31 14:44:34.264: V/camera(23692): autoExposure value =center
12-31 14:44:34.264: V/camera(23692): antiBanding value =60hz
12-31 14:44:34.264: D/CameraSettings(23692): Parameters: [antibanding-values=off,auto,50hz,60hz, antibanding=60hz, auto-exposure-lock-supported=true, auto-exposure-lock-values=false,true, auto-exposure-lock=false, auto-whitebalance-lock-supported=true, auto-whitebalance-lock-values=false,true, auto-whitebalance-lock=false, camera-mode=0, effect-values=mono,negative,none,posterize,sepia,aqua,solarize,nv-vivid,nv-emboss, effect=none, exposure-compensation-step=0.1, exposure-compensation=0, focal-length=2.080, focus-distances=0.95,1.9,Infinity, focus-mode-values=fixed, focus-mode=fixed, horizontal-view-angle=72.600, jpeg-quality=100, jpeg-thumbnail-height=240, jpeg-thumbnail-quality=90, jpeg-thumbnail-size-values=0x0,320x240, jpeg-thumbnail-width=320, max-exposure-compensation=20, max-num-detected-faces-hw=0, max-num-focus-areas=0, max-num-metering-areas=0, max-zoom=28, metering-areas=(0,0,0,0,0), min-exposure-compensation=-20, nv-flip-preview-values=off,vertical,horizontal,both, nv-flip-preview=off, nv-flip-still-values=off,vertical,horizontal,both, nv-flip-still=off, picture-format-values=jpeg,jfif,exif, picture-format=jpeg, picture-size-values=320x240,480x480,640x480,800x600,1024x768,1280x720,1280x960, picture-size=1280x720, preferred-preview-size-for-video=720x576, preview-format-values=yuv420p,yuv420sp, preview-format=yuv420sp, preview-fps-range-values=(4000,60000), preview-fps-range=4000,60000, preview-frame-rate-values=5,8,10,15,20,24,25,30, preview-frame-rate=30, preview-size-values=176x144,320x240,352x288,480x480,640x480,704x576,720x408,720x480,720x576,768x432,800x448,960x720,1280x720, preview-size=1280x720, recording-hint-values=false,true, recording-hint=false, rotation-values=0,90,180,270, rotation=0, smooth-zoom-supported=true, vertical-view-angle=72.600, video-frame-format-values=yuv420p, video-frame-format=yuv420p, video-size-values=40x30,176x144,320x240,352x288,640x480,704x576,720x480,720x576,768x432,1280x720, video-size=1280x720, video-snapshot-supported=true, video-stabilization-supported=false, video-stabilization-values=false,true, video-stabilization=false, whitebalance-values=auto,incandescent,fluorescent,daylight, whitebalance=auto, zoom-ratios=100,125,150,175,200,225,250,275,300,325,350,375,400,425,450,475,500,525,550,575,600,625,650,675,700,725,750,775,800, zoom-supported=true, zoom=0]
12-31 14:44:34.264: V/camera(23692): startPreview
12-31 14:44:34.284: D/NvOsDebugPrintf(154): NvMMLiteBlockCreate : Block : BlockType = 1
12-31 14:44:34.294: D/NvOsDebugPrintf(154): NvMMLiteJPEGEncGetBufferRequirements : BufferSize 1382400
12-31 14:44:34.324: D/(154): Camera fd open as: 141
12-31 14:44:34.534: D/CameraStorage(23692): External storage state=mounted
答案 0 :(得分:0)
您的代码对我来说很合适。您指定的文件是否已创建?