I completed the challenge by creating a 2nd XML menu file with the delete crime item and by overriding “onOptionsItemSelected” in the CrimeFragment.java.
Would a better approach be to use the existing XML file and hiding/unhiding certain Menu items based on which fragment is currently active?
This is only my opinion, but I do not think changing the current menu XML is the best approach.
Sharing this resource would make updating the code a chore, since if you wanted to add a menu item to the list activity, you’d have to make changes in the menu XML, then the list fragment, then the crime fragment to hide the new item!
Thank you. The book is awesome, worth it.
And also, For the More Curious, don’t forget “setHasOptionsMenu(true)” in OnCreate() method of the CrimeFragment class.