public static ContactList getByNumbers(Iterable<String> numbers, boolean canBlock) { ContactList list = new ContactList(); for (String number : numbers) { if (!TextUtils.isEmpty(number)) { list.add(Contact.get(number, canBlock)); } } return list; }
/** * Returns a ContactList for the corresponding recipient ids passed in. This method will create * the contact if it doesn't exist, and would inject the recipient id into the contact. */ public static ContactList getByIds(String spaceSepIds, boolean canBlock) { ContactList list = new ContactList(); for (RecipientIdCache.Entry entry : RecipientIdCache.getAddresses(spaceSepIds)) { if (entry != null && !TextUtils.isEmpty(entry.number)) { Contact contact = Contact.get(entry.number, canBlock); contact.setRecipientId(entry.id); list.add(contact); } } return list; }
public static ContactList getByNumbers( String semiSepNumbers, boolean canBlock, boolean replaceNumber) { ContactList list = new ContactList(); for (String number : semiSepNumbers.split(";")) { if (!TextUtils.isEmpty(number)) { Contact contact = Contact.get(number, canBlock); if (replaceNumber) { contact.setNumber(number); } list.add(contact); } } return list; }
/** * Returns a ContactList for the corresponding recipient URIs passed in. This method will always * block to query provider. The given URIs could be the phone data URIs or tel URI for the numbers * don't belong to any contact. * * @param uris phone URI to create the ContactList */ public static ContactList blockingGetByUris(Parcelable[] uris) { ContactList list = new ContactList(); if (uris != null && uris.length > 0) { for (Parcelable p : uris) { Uri uri = (Uri) p; if ("tel".equals(uri.getScheme())) { Contact contact = Contact.get(uri.getSchemeSpecificPart(), true); list.add(contact); } } final List<Contact> contacts = Contact.getByPhoneUris(uris); if (contacts != null) { list.addAll(contacts); } } return list; }