Google contact name fetch
<p>I want to fetch name of a contact by its id.My code as below:</p>

<pre><code>public void Get_Contact_Name(String id)
{
    String[] projection = new String[] {ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME,
            ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME,
            ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME,
            ContactsContract.CommonDataKinds.StructuredName.SUFFIX,
            ContactsContract.CommonDataKinds.StructuredName.PREFIX,
            ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME};

    String where = ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?"; 
    String[] whereParameters = new String[]{id, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE};

    Cursor contacts = contentresolver.query(ContactsContract.Data.CONTENT_URI, projection, where, whereParameters, null);

    if (contacts.moveToFirst()) { 
        contactcontent.contact_display_name = Null_check((contacts.getString(contacts.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME))));
        contactcontent.contact_given_name = Null_check((contacts.getString(contacts.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME))));
        contactcontent.contact_suffix_name = Null_check((contacts.getString(contacts.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.SUFFIX))));
        contactcontent.contact_prefix_name = Null_check((contacts.getString(contacts.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.PREFIX))));
        contactcontent.contact_middle_name = Null_check((contacts.getString(contacts.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME))));
        contactcontent.contact_family_name = Null_check((contacts.getString(contacts.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME))));
    } 
    contacts.close();

}
</code></pre>

<p>it gives no error but skips the steps of the method.I think the proble in :</p>

<pre><code>    String where = ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?"; 
    String[] whereParameters = new String[]{id, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE};

    Cursor contacts = contentresolver.query(ContactsContract.Data.CONTENT_URI, projection, where, whereParameters, null);
</code></pre>

<p>can anyone check please?</p>

<p>Thanks in advance.
Regards
riskycoder</p>
