Chapter 15 Implicit Intents
Before you can create these implicit intents, there is some setup to do in CriminalIntent:
- add CHOOSE SUSPECT and SEND CRIME REPORT buttons to CrimeFragment’s layouts
- add an mSuspect field to the Crime class that will hold the name of a suspect
- create a crime report using a set of format resource strings
Adding Buttons
You are going to start by updating CrimeFragment’s layout to include new buttons for accusation
and tattling: namely, a suspect button and a report button. First, add the strings that these buttons will
display.
Listing 15.1 Adding button strings (strings.xml)
In layout/fragment_crime.xml, add two button widgets, as shown in Figure 15.2. Notice that in this
diagram we are not showing all of the LinearLayout’s children so that you can focus on the new and
interesting parts of the diagram on the right.
Figure 15.2 Adding suspect and crime report buttons
(layout/fragment_crime.xml)
At this point, you can preview the updated layout or run CriminalIntent to confirm that your new
buttons are in place.