本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java StructuredName.DISPLAY_NAME属性的具体用法?Java StructuredName.DISPLAY_NAME怎么用?Java StructuredName.DISPLAY_NAME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.ContactsContract.CommonDataKinds.StructuredName
的用法示例。
在下文中一共展示了StructuredName.DISPLAY_NAME属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUseContactItemsByName
protected ArrayList<UseContactItem> getUseContactItemsByName(String name) {
ArrayList<UseContactItem> contacts = new ArrayList<UseContactItem>();
if (!SafeSlinger.doesUserHavePermission(Manifest.permission.READ_CONTACTS)) {
return contacts;
}
if (TextUtils.isEmpty(name)) {
return contacts;
}
// find aggregated contact
String[] whereParameters = new String[] {
StructuredName.DISPLAY_NAME, StructuredName.LOOKUP_KEY
};
String where = StructuredName.DISPLAY_NAME + " = "
+ DatabaseUtils.sqlEscapeString("" + name);
Cursor c = getContentResolver().query(Data.CONTENT_URI, whereParameters, where, null, null);
if (c != null) {
try {
if (c.moveToFirst()) {
do {
String tempLookup = c.getString(c
.getColumnIndexOrThrow(StructuredName.LOOKUP_KEY));
String tempName = c.getString(c
.getColumnIndexOrThrow(StructuredName.DISPLAY_NAME));
byte[] tempPhoto = getContactPhoto(tempLookup);
if (!TextUtils.isEmpty(tempLookup)) {
contacts.add(new UseContactItem(tempName, tempPhoto, tempLookup,
UCType.CONTACT));
}
} while (c.moveToNext());
}
} finally {
c.close();
}
}
return contacts;
}
示例2: getProjName
@Override
public String[] getProjName() {
return new String[] {
StructuredName.MIMETYPE, StructuredName.DISPLAY_NAME, StructuredName.FAMILY_NAME,
StructuredName.GIVEN_NAME, StructuredName.MIDDLE_NAME, StructuredName.PREFIX,
StructuredName.SUFFIX, StructuredName.IS_PRIMARY, StructuredName.IS_SUPER_PRIMARY
};
}
示例3: getContactLookupKeyByName
protected String getContactLookupKeyByName(String name) {
// TODO: is there is a better way to match names than literal match?
String contactLookupKey = null;
if (!SafeSlinger.doesUserHavePermission(Manifest.permission.READ_CONTACTS)) {
return contactLookupKey;
}
if (TextUtils.isEmpty(name)) {
return contactLookupKey;
}
// find aggregated contact
String[] whereParameters = new String[] {
StructuredName.DISPLAY_NAME, StructuredName.LOOKUP_KEY
};
String where = StructuredName.DISPLAY_NAME + " = "
+ DatabaseUtils.sqlEscapeString("" + name);
Cursor c = getContentResolver().query(Data.CONTENT_URI, whereParameters, where, null, null);
if (c != null) {
try {
if (c.moveToFirst()) {
do {
String tempLookup = c.getString(c
.getColumnIndexOrThrow(StructuredName.LOOKUP_KEY));
String tempName = c.getString(c
.getColumnIndexOrThrow(StructuredName.DISPLAY_NAME));
// String tempName = getContactName(tempId);
if (!TextUtils.isEmpty(tempName) && name.compareToIgnoreCase(tempName) == 0) {
contactLookupKey = tempLookup;
return contactLookupKey;
}
} while (c.moveToNext());
}
} finally {
c.close();
}
}
return contactLookupKey;
}
示例4: getProjPersonLookupKey
@Override
public String[] getProjPersonLookupKey() {
return new String[] {
StructuredName.DISPLAY_NAME, Data.LOOKUP_KEY, BaseColumns._ID
};
}
示例5: getQueryPersonLookupKey
@Override
public String getQueryPersonLookupKey(String name) {
return StructuredName.DISPLAY_NAME + " = " + DatabaseUtils.sqlEscapeString("" + name);
}