-3

I want to be able to take a picture when it is pressed and then store the picture as normal on the local drive. I have tried using Intent but I believe you have to have permissions or something now but I dont know how to do it. Could someone please show me how I would do this for a button please :)

Rikhil Shah
  • 58
  • 5
  • 10
  • Possible duplicate of [Taking pictures with camera on Android programmatically](http://stackoverflow.com/questions/14421694/taking-pictures-with-camera-on-android-programmatically) – vzsg Dec 05 '16 at 19:48

1 Answers1

0

If you want to use camera you have to set permissions in your manifest file:

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

Source: Camera

To save photos you should have permission:

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

To set intent :

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

If you want something more, here you have How to.

h3wro
  • 62
  • 1
  • 13