Last active
September 21, 2018 06:44
-
-
Save keinix/58d2ceaa0e087db40d508ec1311350b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LiteratureAdapter extends RecyclerView.Adapter { | |
... | |
class BookViewHolder extends RecyclerView.ViewHolder { | |
public BookViewHolder(View itemView) { | |
super(itemView); | |
// get reference to views | |
// itemView.findViewById... | |
} | |
void bindView(int position) { | |
Book book = (Book) mLiteratureList.get(position); | |
// bind data to the views | |
// textView.setText()... | |
} | |
} | |
class MagazineViewHolder extends RecyclerView.ViewHolder { | |
public MagazineViewHolder(View itemView) { | |
super(itemView); | |
// get reference to views | |
} | |
void bindView(int position) { | |
Magazine magazine = (Magazine) mLiteratureList.get(position); | |
// bind data to the views | |
} | |
} | |
class NewspaperViewHolder extends RecyclerView.ViewHolder { | |
public NewspaperViewHolder(View itemView) { | |
super(itemView); | |
// get reference to views | |
} | |
void bindView(int position) { | |
Newspaper newspaper = (Newspaper) mLiteratureList.get(position); | |
// bind data to the views | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment