O'Reilly logo

Android Application Development: A Beginner’s Tutorial by Budi Kurniawan

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

Chapter 19

Taking Pictures

Almost all Android handsets and tablets come with one or two cameras. You can use a camera to take still pictures by starting an activity in the built-in Camera application or use the Camera API.

This chapter shows how to use both approaches.

Overview

An Android application can call another application to use one or two features offered by the latter. For example, to send an email from your application, you can use the default Email application rather than writing your own app. In the case of taking a picture, the easiest way to do this is by using the Camera application. To activate Camera, use the following code.

int requestCode = ...; 
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
startActivityForResult(intent, ...

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