本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java StructuredName.GIVEN_NAME属性的具体用法?Java StructuredName.GIVEN_NAME怎么用?Java StructuredName.GIVEN_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.ContactsContract.CommonDataKinds.StructuredName
的用法示例。
在下文中一共展示了StructuredName.GIVEN_NAME属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
};
}
示例2: queryFromContact
public static boolean queryFromContact(ContentResolver mResolver, String name, String number)
{
ContentValues values = new ContentValues();
// 首先向RawContacts.CONTENT_URI执行一个空值插入,目的是获取系统返回的rawContactId
String where = Data.MIMETYPE + "=? and " + StructuredName.GIVEN_NAME + "=?";
Cursor mCursor =
mResolver.query(ContactsContract.Data.CONTENT_URI, null, where, new String[] {
StructuredName.CONTENT_ITEM_TYPE, name}, null);
System.out.println("--------------------phone--------------------1");
if (mCursor != null)
{
while (mCursor.moveToNext())
{
String rowId = mCursor.getString(mCursor.getColumnIndex(Data.RAW_CONTACT_ID));
String phoneWhere = Data.MIMETYPE + "=? and " + Phone.NUMBER + "=?";
Cursor mPhoneCur =
mResolver.query(ContactsContract.Data.CONTENT_URI, null, phoneWhere, new String[] {
Phone.CONTENT_ITEM_TYPE, number}, null);
if (mPhoneCur != null)
{
while (mPhoneCur.moveToNext())
{
String phoneRowId = mPhoneCur.getString(mPhoneCur.getColumnIndex(Data.RAW_CONTACT_ID));
if (rowId.equals(phoneRowId))
{
mPhoneCur.close();
mCursor.close();
return true;
}
}
}
if (mPhoneCur != null)
{
mPhoneCur.close();
}
}
}
if (mCursor != null)
{
mCursor.close();
}
return false;
}