@Override public void onResume() { super.onResume(); if (mContactsListViewAdapter.getCount() == 0) { // 初始化联系人链表 new LoadDataTask().execute(); } }
private void filterData(String filterData) { List<ContactsItemData> filterDataList = new ArrayList<ContactsItemData>(); if (TextUtils.isEmpty(filterData)) { filterDataList = mContactsList; } else { filterDataList.clear(); for (ContactsItemData item : mContactsList) { String name = item.getContactsUserNickname(); if (name.indexOf(filterData) != -1 || mCharacterParser.getSelling(name).startsWith(filterData.toString())) { filterDataList.add(item); } } } // 根据a-z排序 Collections.sort(filterDataList, mPinyinComparator); mContactsListViewAdapter.updateListView(filterDataList); }