I am not sure if I did or understood something wrong, but on CrimeFragment we save the crimes at onPause.
This save the crimes to a file when CrimeFragment is paused. So when we add a crime, as soon as the activity gets to the paused state, the crime is saved.
When I delete crimes, the change is not being saved anywhere, as the fragment is not CrimeFragment, but CrimeListFragment.
What I thought of doing is add a flag to CrimeLab to indicate whether the crimes files are up to date or not, set this flag to false on addCrime and deleteCrime and set it to true on the constructor and saveCrimes after successfully saving the crimes.
As to when to call saveCrimes, I found I can register a DataObserver on the CrimeAdapter and thought about overriding onChanged and saving there.
Or at onPause on both CrimeFragment and CrimeListFragment.
What are your thoughts on that?