在android中获取联系人的公司名称?

时间:2012-09-19 12:02:50

标签: android cursor android-cursoradapter

您好我正在联系应用程序上做一个应用程序我使用下面的代码获得了联系人ID和显示名称现在我想要的是公司名称单独的联系人ID和显示名称。我可以获得公司名称?

    private void populateContactList() {
    // Build adapter with contact entries

    Cursor cursor = getContacts();
    fields = new String[] { ContactsContract.Data.DISPLAY_NAME,
            ContactsContract.Contacts._ID};



    contactqueryAdaptor = new Contactquery_adaptor(this, R.layout.row,
            cursor, fields, new int[] { R.id.applese });




}

// getContacts()

    private Cursor getContacts() {
    // Run query
    Uri uri = ContactsContract.Contacts.CONTENT_URI;
    String[] projection = new String[] { ContactsContract.Contacts._ID,
            ContactsContract.Contacts.DISPLAY_NAME};
    String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '"
            + (mShowInvisible ? "0" : "1") + "'";
    String[] selectionArgs = null;
    String sortOrder = ContactsContract.Contacts.DISPLAY_NAME
            + " COLLATE LOCALIZED ASC";


    return managedQuery(uri, projection, selection, selectionArgs,
            sortOrder);
}