Creating the CrimeFragment class
After typing in the code as above, click on OnCheckedChangeListener:
mSolvedCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener()
and use the Option+Return (Alt+Enter) shortcut to add the necessary import statement. You will be
presented with two options. Choose the android.widget.CompoundButton version.
Depending on which version of Android Studio you are using, the autocomplete feature
may insert CompoundButton.OnCheckedChangeListener() instead of leaving the code as
OnCheckedChangeListener(). Either implementation is fine. But to remain consistent with the
solution presented in this book, click on CompoundButton and hit Option+Return (Alt+Enter).
Select the option to Add on demand static import for 'android.widget.CompoundButton' (Figure 7.17).
This will update the code so it matches Listing 7.14.
Figure 7.17 Adding on demand static import
Your code for CrimeFragment is now complete. It would be great if you could run CriminalIntent now
and play with the code you have written. But you cannot. Fragments cannot put their views on screen
on their own. To realize your efforts, you first have to add a CrimeFragment to CrimeActivity.