I am trying to implement ViewHolder in my Android app, but I keep getting that ViewHolder cannot be resolved to a type, without any suggestions for an import. Anyone know how to get around this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s because a
ViewHolderis not a class that is from the Android SDK, you make it yourself.Based on what I can find, a
ViewHolderis an implementation that stores Views (per row in a ListView usually) for a larger area, so it is a sort of helper class and cache mechanism. This is one example I found on Android Developers of what aViewHolderwould contain.Then you can implement it in a
ListAdapteror a similar class.