android Programming Glossary: alphaindexer
Custom filtering in Android using ArrayAdapter http://stackoverflow.com/questions/2718202/custom-filtering-in-android-using-arrayadapter private Context context private HashMap String Integer alphaIndexer private String sections new String 0 private Filter filter private.. this.enableSections enableSections if enableSections alphaIndexer new HashMap String Integer for int i items.size 1 i 0 i Manga.. 0 'Z' firstChar.charAt 0 'A' firstChar @ alphaIndexer.put firstChar i Set String keys alphaIndexer.keySet Iterator..
Using Cursor with ListView adapter for a large amount of data http://stackoverflow.com/questions/4330565/using-cursor-with-listview-adapter-for-a-large-amount-of-data Context context private int layout private AlphabetIndexer alphaIndexer public CustomCursorAdapter Context context int layout Cursor.. this.layout layout public void initIndexer Cursor c alphaIndexer new AlphabetIndexer c c.getColumnIndex DataBaseNamesHelper.COLUMN_NAME.. public int getPositionForSection int section return alphaIndexer.getPositionForSection section @Override public int getSectionForPosition..
How to show alphabetical letters on side of Android ListView http://stackoverflow.com/questions/7129069/how-to-show-alphabetical-letters-on-side-of-android-listview implements SectionIndexer private HashMap String Integer alphaIndexer private String sections public AlphabeticalAdapter Context c.. i String s data.get i .substring 0 1 .toUpperCase alphaIndexer.put s i Set String sectionLetters alphaIndexer.keySet ArrayList.. alphaIndexer.put s i Set String sectionLetters alphaIndexer.keySet ArrayList String sectionList new ArrayList String sectionLetters..
Custom filtering in Android using ArrayAdapter http://stackoverflow.com/questions/2718202/custom-filtering-in-android-using-arrayadapter public ArrayList Manga items public ArrayList Manga filtered private Context context private HashMap String Integer alphaIndexer private String sections new String 0 private Filter filter private boolean enableSections public MangaListAdapter Context.. filtered this.context context this.filter new MangaNameFilter this.enableSections enableSections if enableSections alphaIndexer new HashMap String Integer for int i items.size 1 i 0 i Manga element items.get i String firstChar element.getName .substring.. firstChar element.getName .substring 0 1 .toUpperCase if firstChar.charAt 0 'Z' firstChar.charAt 0 'A' firstChar @ alphaIndexer.put firstChar i Set String keys alphaIndexer.keySet Iterator String it keys.iterator ArrayList String keyList new ArrayList..
Using Cursor with ListView adapter for a large amount of data http://stackoverflow.com/questions/4330565/using-cursor-with-listview-adapter-for-a-large-amount-of-data android.widget.AdapterView.OnItemClickListener private Context context private int layout private AlphabetIndexer alphaIndexer public CustomCursorAdapter Context context int layout Cursor c String from int to super context layout c from to this.context.. from int to super context layout c from to this.context context this.layout layout public void initIndexer Cursor c alphaIndexer new AlphabetIndexer c c.getColumnIndex DataBaseNamesHelper.COLUMN_NAME ABCDEFGHIJKLMNOPQRSTUVWXYZ @Override public View.. View.INVISIBLE else button.setVisibility View.VISIBLE @Override public int getPositionForSection int section return alphaIndexer.getPositionForSection section @Override public int getSectionForPosition int position return alphaIndexer.getSectionForPosition..
How to show alphabetical letters on side of Android ListView http://stackoverflow.com/questions/7129069/how-to-show-alphabetical-letters-on-side-of-android-listview close. class AlphabeticalAdapter extends ArrayAdapter String implements SectionIndexer private HashMap String Integer alphaIndexer private String sections public AlphabeticalAdapter Context c int resource List String data super c resource data for int.. List String data super c resource data for int i 0 i data.size i String s data.get i .substring 0 1 .toUpperCase alphaIndexer.put s i Set String sectionLetters alphaIndexer.keySet ArrayList String sectionList new ArrayList String sectionLetters.. i 0 i data.size i String s data.get i .substring 0 1 .toUpperCase alphaIndexer.put s i Set String sectionLetters alphaIndexer.keySet ArrayList String sectionList new ArrayList String sectionLetters Collections.sort sectionList sections new String..
|