I am Trying to launch the detail page of directory contacts(Some organigation contacts) with contact id. for local contacts it is working fine but not working for organigation contacts.
Here is my code. (name is contact name ,idstr is directory id )
lookupByName = ContactsContract.Contacts.CONTENT_FILTER_URI.buildUpon().appendEncodedPath(name)
.appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY, idStr).build();
mCursor = mContext.getContentResolver().query(lookupByName, new String[]{ContactsContract.PhoneLookup.DISPLAY_NAME, ContactsContract.PhoneLookup._ID}, null, null, null);
if (mCursor.moveToFirst()) {
idPhone =
Long.valueOf(mCursor.getString(
mCursor.getColumnIndex(ContactsContract.PhoneLookup._ID)));
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(ContentUris.
withAppendedId(ContactsContract.Contacts.CONTENT_URI, idPhone ));
startActivity(intent);
Please help me.
Thanks in advance.