Last active
March 20, 2016 22:04
-
-
Save konk3r/96c63c2a4e3ded48e3f2 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 ViewHolder extends RecyclerView.ViewHolder { | |
TextView textView; | |
public ViewHolder(View itemView) { | |
super(itemView); | |
// Look up all of your views here, findViewById can be somewhat costl | |
// so you don't want to do it every time the view is recycled | |
textView = ((ViewGroup)itemView).findViewById(R.id.my_text_view); | |
} | |
public void bind(Model model) { | |
// reset all of your views here | |
textView.setColor(defaultColor); | |
textView.setText(model.getText()); | |
etc | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment