The difference between the back button and the up button is expected. When you hit back, you pop back to the previous activity/fragment and onStart
then onResume
will be called. When you tap on the up/home button, you are popped back in the backstack, but the previous activity is recreated from scratch (there’s a discussion about why this is in the book).
As you navigate with back, onResume
will get called and you are refreshing the UI. With the debugger, check to see that the list of crimes has changed when this happens (and your new crime is there). Also verify that the adapter is refreshed with notifyDataSetChanged
or notifyItemChanged
.
It’s hard for me to say what the problem is without seeing all of your code. The code you posted here looks correct to me. If you’d like for me to take a closer look, can you attach a zip of your whole project?