Listing 18.3 error


A minor error in Listing 18.3, the value for v should be set at this point in the book to

View v = inflater.inflate(R.layout.fragment_crime_list, parent, false);

instead of

View v = super.onCreateVIew(inflater, parent, savedInstanceState);


That can’t be right.

fragment_crime_list is a menu resource, that is inflated as the Options menu of CrimeListFragment (see Listing 16.3).

super is rightfully called to create the superclass ListFragment’s layout.

Jay Jun


Jay is right. It’s not typical, but in this specific case, we’re relying on the superclass’s implementation of onCreateView, so we call through.