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);
mCrimeRecyclerView.setAdapter(mAdapter);
} else {
if (mCrimePosition != -1) {
mAdapter.setCrimes(crimes); // code that isn't working
mAdapter.notifyItemChanged(mCrimePosition);
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.