Android - Take picture without preview

后端 未结 3 1263
孤独总比滥情好
孤独总比滥情好 2020-12-06 06:52

I am trying to take a picture without preview, immediately when my application starts running and after that to save the picture in new folder - \"pictures123\", in the root

相关标签:
3条回答
  • 2020-12-06 07:03

    It's impossible to take a picture without preview. You should read the Android online reference: http://developer.android.com/reference/android/hardware/Camera.html#takePicture.

    Note: This method is only valid when preview is active (after startPreview()). Preview will be stopped after the image is taken; callers must call startPreview() again if they want to re-start preview or take more pictures. This should not be called between start() and stop().

    0 讨论(0)
  • 2020-12-06 07:13

    I think the main problem is that you are calling takePicture immediately after startPreview which actually takes time to complete its setup. So adding a delay between those two could temporarily fix this issue, look here for more details.

    0 讨论(0)
  • 2020-12-06 07:25

    You can't take a picture without a preview, but you don't have to show the preview on screen. You can direct the output to a SurfaceTexture instead (API 11+).

    See this answer for more details.

    0 讨论(0)
提交回复
热议问题