Controlling the Camera and Taking Pictures

To access the camera hardware directly, you need to add the camera permission to your application manifest.

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

Use the Camera class to adjust camera settings, specify image preferences, and take pictures.

To access the Camera Service, use the static open method on the Camera class. When your application has finished with the Camera, remember to relinquish your hold on it by calling release, as shown in the simple pattern shown in the Listing 11-12.

LISTING 11-12: Using the Camera

Available for download on Camera camera =; [ ... Do things with the camera camera.release();

The Camera, open method will turn on and initialize the Camera. At this point it is ready for you to modify settings, configure the preuieiv surface, and take pictures, as shown in the following sections.

Was this article helpful?

0 0
Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment