0

In my application i need to show all the phone contact including contact image, currently i read all the data in to array and show ,but in some lower end phones it create problem ,like out of memory is there any alternative way to display the all the phone contact.

NB: the default phone contact intent is not my requirement , i need to get all the phone numbers, and also if first name is empty i need to show the organization name.

4

1 回答 1

0

要显示组织名称,您应该尝试以下代码:

String orgWhere = ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?"; 
  String[] orgWhereParams = new String[]{id, 
   ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE}; 
  Cursor orgCur = cr.query(ContactsContract.Data.CONTENT_URI, 
                null, orgWhere, orgWhereParams, null);
  if (orgCur.moveToFirst()) { 
   String orgName = orgCur.getString(orgCur.getColumnIndex(ContactsContract.CommonDataKinds.Organization.DATA));
   String title = orgCur.getString(orgCur.getColumnIndex(ContactsContract.CommonDataKinds.Organization.TITLE));
  } 
  orgCur.close();
于 2010-12-28T06:13:57.833 回答