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 8437157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:21:27+00:00 2026-06-10T07:21:27+00:00

Inside ArrayAdapter implementing SectionIndexer there is code that checks for list items that starts

  • 0

Inside ArrayAdapter implementing SectionIndexer there is code that checks for list items that starts with the same first letter — so it can be consolidated.

Like this:

    alphaIndexer = new HashMap<String, Integer>();
    int size = objects.length; 

    for (int i = 0; i < size; i++) {

        // Log.d("ObjectLength", String.valueOf(objects.length));

        ItemObject it = objects[i];
        String name = it.name;
        String s = name.substring(0, 1);
        s = s.toUpperCase();

        if (!alphaIndexer.containsKey(s)) {
            alphaIndexer.put(s, i);
        }
    }

    Set<String> sectionLetters = alphaIndexer.keySet();
    ArrayList<String> sectionList = new ArrayList<String>(sectionLetters);
    Collections.sort(sectionList);
    sections = new String[sectionList.size()];

    // sectionList.toArray(sections);

    for (int i = 0; i < sectionList.size(); i++)
        sections[i] = sectionList.get(i);

My question, does consolidating this way effect FastScrolling? Sometimes on ListViews using SectionIndexer, the Fast Scroll isn’t always smooth but “choppy”. I can remove the SectionIndexer from the situation and Fast Scroll suddenly scrolls smoothly and proportionally.

ADDED CODE:

public int getPositionForSection(int section) {
    return alphaIndexer.get(sections[section]);
}

public int getSectionForPosition(int position) {
    return 0;
}

public Object[] getSections() {
        return sections;
    }
  • 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-10T07:21:28+00:00Added an answer on June 10, 2026 at 7:21 am

    SectionIndexer does indeed affect fast scrolling.

    When using a SectionIndexer, you’re saying that you want users to be able to precisely jump to those sections of your data set. If data in those sections is distributed unevenly, then the fast scroller will move proportional to its progress through the set of sections instead of proportional to its progress through each individual item in the data set.

    This is intentional; it’s done this way so that when a user is dragging the fast scroll thumb each section is given equal weight. Precisely targeting any section is as easy as targeting any other section, even if one section only has one item and the sections on either side of it have hundreds.

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

Sidebar

Related Questions

Im having trouble with implementing list view inside a fragment. the xml code is:
Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
Inside the initialize() function there is a jQuery each loop. Inside that loop is
Inside a function I have created, I have this loop that checks if the
I would have listview and a lot of items inside. I want that user
Inside the project folder there is a project's name folder, Release and Debug folder.
Inside my Controller i have function that runs after user clicks on item, which
The following is my code for SettingsActivity.java. The main activity starts this activity by
My code goes inside an OnOptionsItemSelected method. I've tried displaying a simple toast and
i have an android application which has a listview for listing 14 items inside

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.