Heads up on challenge 1


In RunListFragment:

@Override public void onListItemClick(ListView l, View v, int position, long id) { // the id argument will be the Run ID; CursorAdapter gives us this for free Intent i = new Intent(getActivity(), RunActivity.class); i.putExtra(RunActivity.EXTRA_RUN_ID, id); startActivity(i); }

Just a heads up that if you implement the first challenge and you find that bindView is not being called when you are not creating a new item, note the small bug in RunListFragment:
startActivity is called and not startActivityForResult, which is needed to call onActivityResult, which is where the getLoaderManager.restartLoader is being called, which is needed to get a bindView call after hitting the back button.
Of course you already saw it! Of course you could work around it…but out of the box it is an annoying bug that
caused me to lose an few minutes of time… : )



I found that changing this to startActivityForResult didn’t work for me. The way I was able to get “bindView” in the Adapter to be called when hitting the back button was to override RunListFargment’s “onResume” function and tell the adapter to refresh itself.

@Override public void onResume() { super.onResume(); mCursorAdapter.notifyDataSetChanged(); }