I knew I should have included that... This is a bit messy at the
moment.
private static final String[] CURSOR_COLUMNS = new String[]
{ BaseColumns._ID, LiveFolders.NAME, LiveFolders.DESCRIPTION,
LiveFolders.INTENT, LiveFolders.ICON_PACKAGE,
LiveFolders.ICON_RESOURCE, LiveFolders.ICON_BITMAP };
public static MatrixCursor loadNewData(ContentProvider cp, Uri
uri)
{
MatrixCursor mc = new MatrixCursor(CURSOR_COLUMNS); Cursor
groupContacts = null;
try
{
groupContacts = cp.getContext().getContentResolver().query
(Uri.parse("content://contacts/groups/name/" + uri.getLastPathSegment
() + "/members"), CONTACTS_COLUMN_NAMES, null, null, null);
while(groupContacts.moveToNext())
{
String timesContacted = "Times contacted: " +
groupContacts.getInt(2);
Bitmap Icon = People.loadContactPhoto(cp.getContext(),
ContentUris.withAppendedId(People.CONTENT_URI, groupContacts.getLong
(0)), R.drawable.icon, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Icon.compress(CompressFormat.PNG, 0, baos);
Object[] rowObject = new Object[]
{
groupContacts.getLong(0),
groupContacts.getString(1),
timesContacted,
ContentUris.withAppendedId(People.CONTENT_URI,
groupContacts.getLong(0)),
cp.getContext().getPackageName(),
R.drawable.icon,
baos.toByteArray()
};
mc.addRow(rowObject);
}
return mc;
}
finally
{
if (groupContacts != null && groupContacts.isClosed() !=
true)
{
groupContacts.close();
}
}
}
On Sep 30, 9:35 am, Romain Guy <[email protected]> wrote:
> Oh yeah, it used to but does not anymore.
>
> Anyway, without seeing your code...
>
> On Wed, Sep 30, 2009 at 9:29 AM, nEx.Software
>
>
>
> <[email protected]> wrote:
>
> > The default contacts live folders don't pass photos from what I could
> > tell in the source. I tried to send as PNG byte array to no avail.
> > I'll try JPEG and see if that makes a difference. Thanks Romain.
>
> > On Sep 30, 9:26 am, Romain Guy <[email protected]> wrote:
> >> You can also look at the source code of the default live folders to
> >> see how the contacts live folders are implemented.
>
> >> On Wed, Sep 30, 2009 at 9:18 AM, nEx.Software
>
> >> <[email protected]> wrote:
>
> >> > This is incredibly frustrating. If it helps, I get the same error
> >> > regardless of whether it is a Contact photo or any other Bitmap. I
> >> > even tried sending as a byte array. No luck. Always a
> >> > NullPointerException when the Launcher application tries to
> >> > "createBitmapThumbnail". It seems it is getting passed a null bitmap.
>
> >> > LiveFolders seem to be incredibly unpopular so there is like no
> >> > information anywhere. Any google folks (Romain maybe?) have any input?
> >> > Of course I'll take just about any input at this point.
>
> >> > On Sep 29, 2:11 pm, "nEx.Software" <[email protected]>
> >> > wrote:
> >> >> I was hoping to include thephotofor eachcontactin a live folder. I
> >> >> am using People.loadContactPhoto() to get a bitmap and am placing it
> >> >> into the content provider's result column for LiveFolders.ICON_BITMAP
> >> >> but I keep getting a NullPointerException. Any ideas? Should I not be
> >> >> doing this?
>
> >> --
> >> Romain Guy
> >> Android framework engineer
> >> [email protected]
>
> >> Note: please don't send private questions to me, as I don't have time
> >> to provide private support. All such questions should be posted on
> >> public forums, where I and others can see and answer them
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support. All such questions should be posted on
> public forums, where I and others can see and answer them
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---