Created
November 29, 2013 01:31
-
-
Save mbeaty/7700379 to your computer and use it in GitHub Desktop.
Android ViewHolder pattern rework
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
An alternative to the traditional Google-recommended ViewHolder pattern. This implementation you don't have to create a ViewHolder class per view: | |
https://github.com/BoD/jraf-android-util/blob/master/src/org/jraf/android/util/ui/ViewHolder.java | |
"Example usage, in your adapter: | |
TextView name = ViewHolder.get(convertView, R.id.name); | |
(As you can see you can even skip the cast because of the generics trick.)" | |
Quote reference: BoD comment here: http://daniel-codes.blogspot.com/2013/11/is-findviewbyid-slow.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment