July 2015
Beginner to intermediate
600 pages
18h 59m
English
Next, you are going to make the CheckBox 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) {
...
Next, in onCreateView(…), get a reference to the new button, set its text as the date of the crime, and disable it ...
Read now
Unlock full access