Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5840605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:46:19+00:00 2026-05-22T11:46:19+00:00

I learned Android’s ArrayAdapter today, and find there is a commom pattern which uses

  • 0

I learned Android’s ArrayAdapter today, and find there is a commom pattern which uses a ViewHolder to hold Views’ reference instead of calling findViewById everytime.

But how does it work? Adapter is usually used to display a list of View(Group)s, If I cache the View, why don’t they all reference to the oldest one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:46:20+00:00Added an answer on May 22, 2026 at 11:46 am

    If you want the best explanation on how the ViewHolder works, check out Romain Guy’s Google I/O 2009 talk in youtube , specially the first 15 minutes.

    In short, the Adapter functions as a link between the underlying data and the ViewGroup. It will render as many Views as required to fill the screen. Upon scrolling or any other event that pushes a View is out of the screen, the Adapter will reuse that View, filled with the correct data, to be rendered at the screen.

    The getView(int pos, View view, ViewGroup parent) method will use the right View at any time, regardless of your layout. I do not know the internals of this, but I’m sure you can browse the source code for any adapter (such as ArrayAdapter.java) if you’re interested.
    The ViewHolder just keeps a pointer to the Views as obtained by view.findViewById(int id). It is the Adapter responsibility to return the right data corresponding to any position.

    Slides 11 to 13 of Romain’s presentation will make it a lot more clear than anything I can write.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have learned that when using android:entries with a ListView , it uses android.R.layout.simple_list_item_1
I learned today that NetBeans 6.5 should have an on-the-fly compilation of (single) Java
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
I learned C++ when it was C with classes. I find myself increasingly disliking
I learned that the Android Scripting Environment (ASE) supports python code. Can I take
When i started learning android i learned that R.java files goes to /gen folder
I've been intrigued by all the android world since I first learned about it
I consider myself an Android developer, after having created four apps and learned a
I learned about the debug tool of ndk-gdb from Android NDK r4. Now I
I learned that memset(ptr, 0, nbytes) is really fast, but is there a faster

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.