What is "android-camera"

The Android Framework includes support for cameras and camera features available on devices.

The framework allows the capture of photos and videos through the api android.hardware.camera2 or via Intent.

To build an application using the camera directly view Building a Camera App(API<21) and android.hardware.camera2(API>=21), in the Android documentation.

For applications that just want to get, easily and quickly, a photo or a clip video view Using Existing Camera Apps.

Recourse to a Intent facilitates the creation of the application, as it delegates the manipulation of the camera to an existing application.

There are 3 steps to implement:

  • Create a Intent, of the kind ACTION_IMAGE_CAPTURE or ACTION_VIDEO_CAPTURE to request, from an existing application, a photo or video respectively.

  • Launch the Intent, through the method startActivityForResult(), to start an application that will allow you to get the photo or video.

  • Receive and process the result of Intent in the method onActivityResult(), who will be called after taking the photo or video.

Other classes involved in camera use:

  • Camera - The old and now obsolete (from API21) class for manipulating the camera.
  • Surfaceview - Class used to display the live camera view.
  • Mediarecorder - Class used to record video via camera.