I'm having trouble getting the new contact photo methods for 0.9 beta
to work correctly.
This is what I do currently:
private static boolean storePhoto(Context context, AndroidContact
ac,Uri personUri)
{
byte[] bytes =
ExternalServices.retrieveBytesFromURL(ac.photoUrl);
People.setPhotoData(context.getContentResolver(), personUri,
bytes);
return true;
}
where the path of the personUri is something like "/people/57"
To retrieve, I use the same personUri, and do:
public void loadPhoto(Uri personUri) throws Exception
{
Bitmap b = null;
b=People.loadContactPhoto(f_context, personUri,
R.drawable.no_photo_found,null);
if (b!=null)
photoView.setImageBitmap(b);
else
photoView.setImageResource(R.drawable.no_photo_found);
}
Store seems to work correctly as far as I can tell, but retrieve
throws a NullPointerException on the line
b=People.loadContactPhoto(f_context, personUri,
R.drawable.no_photo_found,null);
which is amazing, because none of the parameters (outside of the last
one) are null.
What is going on?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---