Take Picture without preview Android

前端 未结 3 820
太阳男子
太阳男子 2020-12-06 06:31

I would like to take a picture without any preview. I used this code but I\'m getting an error:

 public void onCreate(Bundle savedInstanceState) {
    super.         


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

    Regarding your Fail to initialize camera error, another possibility is the camera is in use by something else.

    0 讨论(0)
  • 2020-12-06 06:57

    Android can't use camera without a preview... but, you can set the preview size like 1x1 px, then you won't see it and you can use the camera anyway.

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

    Use this permissions :

     <uses-permission android:name="android.permission.CAMERA" />
     <uses-feature android:name="android.hardware.camera" />
    

    And you can instantiate a Camera object using this

    Camera mycamera = Camera.open();
    

    You can try the method described here is very simple if you are into simplicity:

    http://developer.android.com/training/camera/photobasics.html

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