Pressing back does not create a new Crime

In the part that says Refreshing model data I add the setCrimes and call it in the updateUI(), but it does not update the CrimeListFragment view. Rather, if I make a new crime and press the Up button, then it now shows the crime I just made and the one that never showed. I also did the challenge in Ch 10, so my code looks like this:

if (mAdapter == null) {
    mAdapter = new CrimeAdapter(crimes);
} else {
    if (mCrimePosition != -1) {
        mAdapter.setCrimes(crimes); // code that isn't working
        mCrimePosition = -1;

Do I have to completely change my code to accommodate the RecyclerView reloading code, or is it just in the wrong place? I have put it in a couple different places to no avail.

I’m guessing it’s because you are using the notifyItemChanged method rather than notifyDataSetChanged. Maybe you have an issue with the mCrimePosition that is used?

Yes! You pointing out the notifyDataSetChanged call made me go back and realize that I never updated the model if the adapter position never changed which would need a notifyDataSetChanged call. I changed it to have an else with the if that called it with a setCrimes call before that. Thank you!