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


Java Data.DISPLAY_NAME属性代码示例

本文整理汇总了Java中android.provider.ContactsContract.Data.DISPLAY_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java Data.DISPLAY_NAME属性的具体用法?Java Data.DISPLAY_NAME怎么用?Java Data.DISPLAY_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.ContactsContract.Data的用法示例。


在下文中一共展示了Data.DISPLAY_NAME属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContactsCursor

private Cursor getContactsCursor(ContentResolver cr) {
	String req = "(" + Data.MIMETYPE + " = '" + CommonDataKinds.Phone.CONTENT_ITEM_TYPE
			+ "' AND " + CommonDataKinds.Phone.NUMBER + " IS NOT NULL "
			+ " OR (" + Data.MIMETYPE + " = '" + CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE
			+ "' AND " + CommonDataKinds.SipAddress.SIP_ADDRESS + " IS NOT NULL))";
	String[] projection = new String[] { Data.CONTACT_ID, Data.DISPLAY_NAME };
	String query = Data.DISPLAY_NAME + " IS NOT NULL AND (" + req + ")";

	Cursor cursor = cr.query(Data.CONTENT_URI, projection, query, null, " lower(" + Data.DISPLAY_NAME + ") COLLATE UNICODE ASC");
	if (cursor == null) {
		return cursor;
	}

	MatrixCursor result = new MatrixCursor(cursor.getColumnNames());
	Set<String> groupBy = new HashSet<String>();
	while (cursor.moveToNext()) {
	    String name = cursor.getString(cursor.getColumnIndex(Data.DISPLAY_NAME));
	    if (!groupBy.contains(name)) {
	    	groupBy.add(name);
	    	Object[] newRow = new Object[cursor.getColumnCount()];

	    	int contactID = cursor.getColumnIndex(Data.CONTACT_ID);
	    	int displayName = cursor.getColumnIndex(Data.DISPLAY_NAME);

	    	newRow[contactID] = cursor.getString(contactID);
	    	newRow[displayName] = cursor.getString(displayName);

	        result.addRow(newRow);
    	}
    }
	cursor.close();
	return result;
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:33,代码来源:ContactsManager.java

示例2: getEmailAdapterProjection

/**
 * Get the NEW_PROJECTION for EmailAddressAdapter.
 */
public static String[] getEmailAdapterProjection() {
  String[] emailAdapterProjection = {
    Data._ID,
    Data.DISPLAY_NAME,
    Email.ADDRESS,
    Data.MIMETYPE,
  };
  return emailAdapterProjection;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:12,代码来源:HoneycombMR1Util.java

示例3: getDisplayName

/**
 * Get Data.DISPLAY_NAME for EmailAddressAdapter.
 */
public static String getDisplayName() {
  return Data.DISPLAY_NAME;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:6,代码来源:HoneycombMR1Util.java


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