Using a Camera Intent

The next step is to actually take the picture. This is the easy part: you get to use an implicit intent again.

Start by stashing the location of the photo file. (You will use it a few more times, so this will save a bit of work.)

Listing 16.4  Grabbing photo file location (CrimeFragment.java)

.​.​.​

p​r​i​v​a​t​e​ ​C​r​i​m​e​ ​m​C​r​i​m​e​;​
p​r​i​v​a​t​e​ ​F​i​l​e​ ​m​P​h​o​t​o​F​i​l​e​;​ p​r​i​v​a​t​e​ ​E​d​i​t​T​e​x​t​ ​m​T​i​t​l​e​F​i​e​l​d​;​ .​.​.​ @​O​v​e​r​r​i​d​e​ p​u​b​l​i​c​ ​v​o​i​d​ ​o​n​C​r​e​a​t​e​(​B​u​n​d​l​e​ ​s​a​v​e​d​I​n​s​t​a​n​c​e​S​t​a​t​e​)​ ​{​ ​ ​ ​ ​s​u​p​e​r​.​o​n​C​r​e​a​t​e​(​s​a​v​e​d​I​n​s​t​a​n​c​e​S​t​a​t​e​)​;​ ​ ​ ​ ​U​U​I​D​ ​c​r​i​m​e​I​d​ ​=​ ​(​U​U​I​D​)​ ​g​e​t​A​r​g​u​m​e​n​t​s​(​)​.​g​e​t​S​e​r​i​a​l​i​z​a​b​l​e​(​A​R​G​_​C​R​I​M​E​_​I​D​)​;​ ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition 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.