Skip to content Skip to sidebar Skip to footer

Get Profile Picture Of Specific Phone Number From Contacts Information

I am developing message send/receive application, and i need to get profile picture of phone number. Could any one please help me to get the profile picture of specific number? Tha

Solution 1:

public static int getContactIDFromNumber(String contactNumber,Context context)
{
    contactNumber = Uri.encode(contactNumber);
    int phoneContactID = new Random().nextInt();
    Cursor contactLookupCursor = context.getContentResolver().query(Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(contactNumber)),new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup._ID}, null, null, null);
        while(contactLookupCursor.moveToNext()){
            phoneContactID = contactLookupCursor.getInt(contactLookupCursor.getColumnIndexOrThrow(PhoneLookup._ID));
            }
        contactLookupCursor.close();

    return phoneContactID;
}

The above method returns contactId of specific phone number and refer this LINK to get profile picture from contactID.


Post a Comment for "Get Profile Picture Of Specific Phone Number From Contacts Information"