@Override public void removeFromFav(Movie movie) { String selection = MoviesContract.FavMoviesEntry._ID + " = ? "; String[] selectionArgs = {movie.getId() + ""}; contentResolver.delete(MoviesContract.FavMoviesEntry.CONTENT_URI, selection, selectionArgs); }
@Override public void addToFav(Movie movie) { ContentValues contentValues = new ContentValues(); contentValues.put(MoviesContract.FavMoviesEntry._ID, movie.getId()); contentValues.put(MoviesContract.FavMoviesEntry.COLUMN_TITLE, movie.getTitle()); contentValues.put(MoviesContract.FavMoviesEntry.COLUMN_COUNT, movie.getVote_count()); contentValues.put(MoviesContract.FavMoviesEntry.COLUMN_OVERVIEW, movie.getOverview()); contentValues.put(MoviesContract.FavMoviesEntry.COLUMN_POSTER_PATH, movie.getPoster_path()); contentValues.put(MoviesContract.FavMoviesEntry.COLUMN_RELEASE_DATE, movie.getRelease_date()); contentValues.put(MoviesContract.FavMoviesEntry.COLUMN_VOTE_AVERAGE, movie.getVote_average()); contentResolver.insert(MoviesContract.FavMoviesEntry.CONTENT_URI, contentValues); }