Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Per <a href="http://developer.android.com/reference/android/widget/AbsListView.html#setFastScrollEnabled%28boolean%29" rel="nofollow">ListView.setFastScrollEnabled</a>, you need to enable fast scrolling and ensure that your adapter implements <a href="http://developer.android.com/reference/android/widget/SectionIndexer.html" rel="nofollow">SectionIndexer</a> (which translates positions to sections). A helper class, <a href="http://developer.android.com/reference/android/widget/AlphabetIndexer.html" rel="nofollow">AlphabetIndexer</a> can be used if your adapter is backed by a <code>Cursor</code> such as:</p> <pre><code>public class MyAdapter extends CursorAdapter implements SectionIndexer { // All valid characters. May want to include numbers, etc if they show up // in your sort column private final static String ALPHABET = "abcdefghijklmnopqrstuvwxyz"; private AlphabetIndexer mIndexer = null; public MyAdapter(Context context, Cursor c, int flags) { super(context, c, flags); // Assumes your cursor is non-null, // otherwise do this in swapCursor if mIndexer==null final int sortColumnIndex = c.getColumnIndex(YOUR_SORT_COLUMN_NAME); mIndexer = new AlphabetIndexer(c, sortColumnIndex, ALPHABET); } public Cursor swapCursor(Cursor newCursor) { super.swapCursor(newCursor); // Make sure the AlphabetIndexer knows about the new Cursor mIndexer.setCursor(newCursor); } public int getPositionForSection(int section) { // AlphabetIndexer does all the hard work return mIndexer.getPositionForSection(section); } public int getSectionForPosition(int position) { // AlphabetIndexer does all the hard work return mIndexer.getSectionForPosition(position); } public Object[] getSections() { // AlphabetIndexer does all the hard work return mIndexer.getSections(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload