O'Reilly logo

Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets by Shawn Van Every

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

http://developer.android.com/reference/android/hardware/Camera.html

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required