2012-10-11 38 views
0

我已经创建了一个名为:ContactsAdapter的自定义适配器,它继承自BaseAdapter并实现了ISectionIndexerBaseAdapter with AlphabetIndexer

是否可以在不使用ICursor的情况下在自定义适配器上实现AlphabetIndexer?原因是,适配器使用List<T>来存储所有项目。

非常感谢提前!

回答

0

简答题; 是的你可以做到这一点,而不使用ICursor。基本上你实现你的BaseAdapter<T>

ISectionIndexer实现接口ISectionIndexer包括下列方法:

public int GetPositionForSection(int section) 
    { 
     ... 
    } 

    public int GetSectionForPosition(int position) 
    { 
     ... 
    } 

    public Java.Lang.Object[] GetSections() 
    { 
     ... 
    } 

亲切的问候,

0

如何在将它设置到适配器之前对列表进行排序?

像:

Collections.sort(list, String.CASE_INSENSITIVE_ORDER); 

要需要排序的对象列表来实现Comparable

+0

你能否更具体?我不确定这将如何为我提供一个ICursor。非常感谢! –