Running on phone device


I have noticed a slight bug when running the single pane version of the app. When returning to CrimeListFragment from CrimePagerActivity, the changed or new ‘Crime’ doesn’t have show the update/added title, date or solved checkbox. I was thinking that overriding onResume() and re-populating the array would fix this issue, since onResume() is only used when CrimePagerActivity ‘returns’ to CrimeListFragment. I have tried several placements of onResume(), but have not been able to get CrimeListActivity to refresh the view with the updated Array? Any ideas?


What you need is a call to adapter.notifyDataSetChanged() inside CrimeListFragment.onResume(). The code for that should be somewhere in the Fragment Arguments chapter, IIRC.


Thank you, that fixed it. I didn’t find a mention of “onResume()” in the chapter mentioned. I just copied “((CrimeAdapter)getListAdapter()).notifyDataSetChanged();” from the “public void updateUI()” into a new “onResuem()” Override. The final code looks like this:

public void onResume() {

Since onResume() isn’t used in the two pane version, it doesn’t effect the way that works. (Tested and verified)



I just checked the Chapter 22 code available for download, and indeed onResume() is not there. Are we positive this isnt an error? I only have the kindle edition, not sure if the print edition has this code.