Beispiel #1
0
    @Override
    protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
      if (cursor != null && cursor.getCount() > 0) {

        list = new ArrayList<ContactBean>();
        cursor.moveToFirst();
        for (int i = 0; i < cursor.getCount(); i++) {
          cursor.moveToPosition(i);
          String name = cursor.getString(1);
          String number = cursor.getString(2);
          String sortKey = cursor.getString(3);
          int contactId = cursor.getInt(4);
          Long photoId = cursor.getLong(5);
          String lookUpKey = cursor.getString(6);

          ContactBean cb = new ContactBean();
          cb.setDisplayName(name);
          cb.setPhoneNum(number);
          cb.setSortKey(sortKey);
          cb.setContactId(contactId);
          cb.setPhotoId(photoId);
          cb.setLookUpKey(lookUpKey);

          list.add(cb);
        }
        if (list.size() > 0) {
          setAdapter(list);
        }
        cursor.close();
      }
    }