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

  • SEARCH
  • Home
  • 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 9156791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:51:19+00:00 2026-06-17T12:51:19+00:00

I implemented a Section List View following instruction from https://nodeload.github.com/necronet/section-list/zip/master . Everything working fine,

  • 0

I implemented a Section List View following instruction from https://nodeload.github.com/necronet/section-list/zip/master.
Everything working fine, but just out of curiosity, I want to know how Android OS give me correct convertView in the getView function of the Adapter (code below). There are two types of views (two different layout files), one SectionView and ItemView. Imagine a situation, when a fist section and an item are scrolled out of the screen, so there are two views that are in the View Recycler. Then a new view is about to be scrolled in from the bottom. In the getView function, I have to check the position, by the function isSection, to determine what view should I give at that position. The amazing thing is that Android OS (or whatever underlying) always give me the correct convertView (among the two types of views in the Recycler) to recycle, how does it know before I even check? Thanks.

 public View getView(final int position, final View convertView,
                        final ViewGroup parent) {
        if (isSection(position)) {
            return getSectionView(convertView, sectionPositions.get(position));
        }
        return getItemView(getLinkedPosition(position), convertView,
                parent);
    }
  • 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-06-17T12:51:20+00:00Added an answer on June 17, 2026 at 12:51 pm

    This is my understanding of how getView works in an adapter:

    This will return what ‘type’ of view the particular item in the list is – and thus use the correct convertView in getView()

    @Override
    public int getItemViewType(int position) {
        return 0;
    }
    

    And this returns how many different types of views there are:

    @Override
    public int getViewTypeCount() {
        return 0;
    }
    

    Of course these don’t return 0 in proper code.

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

Sidebar

Related Questions

I am using this sample code https://github.com/chrtatu/FacebookFriendsList to get the list of FB friends
I have implemented a left side list view in split view using the following
I follow example from here using section listview http://lalit3686.blogspot.com/2012/05/sectionadapter.html But how can I implement
I've implemented a custom index section list by programmatically adding buttons using a loop.
I am currently writing a Java compiler and have implemented section 15.12.2.7. of the
I am building an iPhone app and I have implemented a section for knowledge
I've implemented this method to return the section header height. However, when the height
I implemented the Facebook registration on my website. Everything works fine except that suddenly
I have implemented Section Indexer for an Adapter class which extends BaseAdapter. Now for
I have implemented a Section header Listview where i inflate a layout which have

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.