Using the Camera Class

The Camera class in Android is what we use to access the camera hardware on the device. It allows us to actually capture an image, and through its nested Camera.Parameters class, we can change set various attributes, such as whether the flash should be activated and what value the white balance should be set to.

Camera Permissions

In order to use the Camera class to capture an image, we need to specify in our AndroidManifest.xml file that we require the CAMERA permission.

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

Preview Surface

Also before we can get started using the camera, we need to create some type of Surface for the Camera to ...

Get Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.