Passing Data Back to CrimeFragment

To give CrimeFragment access to the photo, you are going to pass the filename back from CrimeCameraFragment. Figure 20.5 shows the sequence of events between CrimeFragment and CrimeCameraFragment.

Figure 20.5  CrimeCameraActivity sets a result and an extra

CrimeCameraActivity sets a result and an extra

First, CrimeFragment will start CrimeCameraActivity for a result. When a picture is taken, CrimeCameraFragment will create an intent with the filename as an extra and call setResult(…). The ActivityManager will forward the intent to CrimePagerActivity in onActivityResult(…). CrimePagerActivity’s FragmentManager will then forward the intent to CrimeFragment

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.