I’m working on an android application thats dealing with contact.
I have used the following code in android 1.6 and it works fine.
public static Uri getProfilepicture(Activity activity, String address)
{
Uri personUri = Uri.withAppendedPath(Phones.CONTENT_FILTER_URL, address);
Cursor phoneCursor = activity.getContentResolver().query(personUri,PHONE_PROJECTION, null, null, null);
if (phoneCursor.moveToFirst())
{
int indexPersonId = phoneCursor.getColumnIndex(Phones.PERSON_ID);
long personId = phoneCursor.getLong(indexPersonId);
phoneCursor.close();
Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, personId);
return uri;
}
return null;
}
and getting photo in bitmap like
Bitmap bm = People.loadContactPhoto(activity,getProfilepicture(activity, ConNum, R.drawable.artist, null);
Can any one suggest code for android 2.1 please?
Thanks Friends to trying to help me. i have solve the problem by following code.
in that just pass the activity object and contactId. and store it into bitmam.