@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Cursor cursor = movieAdapter.getCursor(); cursor.moveToPosition(position); int columnMovieId = -1; if (currentType == FetchMoviesTask.TYPE_POP) { columnMovieId = cursor.getColumnIndex(MovieContract.PopMovieEntry.COLUNM_MOVIE_KEY); } else { columnMovieId = cursor.getColumnIndex(MovieContract.RateMovieEntry.COLUNM_MOVIE_KEY); } long movieId = cursor.getLong(columnMovieId); Intent intent = new Intent(getActivity(), DetailActivity.class); intent.putExtra(INTENT_MOVIE_ID, movieId); startActivity(intent); }
@Override public void onLoaderReset(Loader<Cursor> loader) { movieAdapter.swapCursor(null); }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { movieAdapter.swapCursor(data); }