void onSortPreferenceChanged(String newSort) { // replace the uri, since the location has changed Uri uri = mUri; if (null != uri) { int movieId = MovieEntry.getMovieIdFromUri(uri); Uri updatedUri = MovieEntry.buildMovieIdUri(movieId); mUri = updatedUri; getLoaderManager().restartLoader(DETAIL_LOADER, null, this); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); /*if (arguments != null) { mMovieId = arguments.getInt(DetailActivity.MOVIE_KEY); }*/ if (arguments != null) { mUri = arguments.getParcelable(DetailFragment.DETAIL_URI); } if (mUri != null) { mMovieId = MovieEntry.getMovieIdFromUri(mUri); } /*if (savedInstanceState != null) { mLocation = savedInstanceState.getString(LOCATION_KEY); }*/ return inflater.inflate(R.layout.fragment_detail, container, false); }