title: Is there any mistake in this code, which shows fast scroll list with alphabet preview
body: <p>I am facing problem in showing the preview of first letter in Android listview, when i do fast scroll i get the preview of text but it will be pointing to the wrong location in list.</p>
  
  <p>For eg, please have a look at the below image, in this now we are in M section, still L letter is appearing. </p>
  
  <p><img src="https://i.stack.imgur.com/lUTnW.png" alt="enter image description here"></p>
  
  <p>Here is the Listadapter code, which implements the above Technic, any mistake in the code?</p>
  
  <pre><code>    class MyListAdaptor extends ArrayAdapter&lt;String&gt; implements
          SectionIndexer 
  {
  
      HashMap&lt;String, Integer&gt; alphaIndexer;
      String[] sections;
  
      public MyListAdaptor(Context context, LinkedList&lt;String&gt; items) {
          super(context, R.layout.list_item, items);
  
          alphaIndexer = new HashMap&lt;String, Integer&gt;();
          int size = items.size();
  
          for (int x = 0; x &lt; size; x++) {
              String s = items.get(x);
  
              // get the first letter of the store
              String ch = s.substring(0, 1);
              // convert to uppercase otherwise lowercase a -z will be sorted
              // after upper A-Z
              ch = ch.toUpperCase();
  
              // HashMap will prevent duplicates
              alphaIndexer.put(ch, x);
          }
  
          Set&lt;String&gt; sectionLetters = alphaIndexer.keySet();
  
          // create a list from the set to sort
          ArrayList&lt;String&gt; sectionList = new ArrayList&lt;String&gt;(
                  sectionLetters);
  
          Collections.sort(sectionList);
  
          sections = new String[sectionList.size()];
  
          sectionList.toArray(sections);
      }
  
      public int getPositionForSection(int section) {
          return alphaIndexer.get(sections[section]);
      }
  
      public int getSectionForPosition(int position) {
          return 0;
      }
  
      public Object[] getSections() {
          return sections;
      }
  }
  </code></pre>