当前位置: 首页>>代码示例>>Java>>正文


Java StructuredName.DISPLAY_NAME属性代码示例

本文整理汇总了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;
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:38,代码来源:BaseActivity.java

示例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
    };
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:8,代码来源:ContactAccessorApi5.java

示例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;
    }
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:41,代码来源:BaseActivity.java

示例4: getProjPersonLookupKey

@Override
public String[] getProjPersonLookupKey() {
    return new String[] {
            StructuredName.DISPLAY_NAME, Data.LOOKUP_KEY, BaseColumns._ID
    };
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:6,代码来源:ContactAccessorApi5.java

示例5: getQueryPersonLookupKey

@Override
public String getQueryPersonLookupKey(String name) {
    return StructuredName.DISPLAY_NAME + " = " + DatabaseUtils.sqlEscapeString("" + name);
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:4,代码来源:ContactAccessorApi5.java


注:本文中的android.provider.ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。