Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Created August 7, 2018 18:25
Show Gist options
  • Save anitaa1990/8fdb97a05cdd66b253a721be65e2bbde to your computer and use it in GitHub Desktop.
Save anitaa1990/8fdb97a05cdd66b253a721be65e2bbde to your computer and use it in GitHub Desktop.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Movie movie = movies.get(position);
holder.title.setText(movie.getTitle());
holder.rating.setText(movie.getRating());
//SRP violation, onBindViewHolder has only the responsibility to display data
// & not make data formatting operations
String[] genres = song.getGenres();
StringBuilder builder = new StringBuilder();
foreach (String genre : genres){
builder.append(genre).append(",");
}
holder.genres.setText(builder.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment