Android open camera from button

前端 未结 10 1594
無奈伤痛
無奈伤痛 2020-11-29 03:24

I hope this isn\'t a duplicate question but I am making an app that I want a button to open the camera app (the default android camera separately). How do I got about doing

10条回答
  •  孤城傲影
    2020-11-29 04:12

    To call the camera you can use:

    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    startActivity(intent);
    

    The image will be automatically saved in a default directory.

    And you need to set the permission for the camera in your AndroidManifest.xml:

     
    

提交回复
热议问题