March 2013
Beginner to intermediate
580 pages
16h 11m
English
The CheckBox needs to display whether a Crime has been solved. You also need to update the Crime’s mSolved field when a user toggles the CheckBox.
For now, all the new Button needs to do is display the date in the Crime’s mDate field.
In CrimeFragment.java, add two new instance variables.
Listing 8.5 Adding widget instance variables (CrimeFragment.java)
public class CrimeFragment extends Fragment {
private Crime mCrime;
private EditText mTitleField;
private Button mDateButton;
private CheckBox mSolvedCheckBox;
@Override
public void onCreate(Bundle savedInstanceState) {
...
Organize your imports to resolve the reference to CheckBox.
Next, in onCreateView(…), get a reference to the new button, set its text as the date of the crime, ...
Read now
Unlock full access