Finally got it to work. I needed to override fillWindow in my MatrixCursor and tell it to not get String values for every column.
On Oct 1, 8:35 am, "nEx.Software" <email.nex.softw...@gmail.com> wrote: > Arg! So, I found the bug. Kind of. Somehow, all "get" calls (getLong > (), getBlob(), and of course getString()) on my Cursor are being > treated as getString(). This makes no sense to me at all. Why are they > not getting directed to the correct functions? > > On Sep 30, 12:14 pm, "nEx.Software" <email.nex.softw...@gmail.com> > wrote: > > > I found the source of my problem. MatrixCursor is dropping my byte > > array for some reason. Now, to find out why. Yay bug hunting... > > > On Sep 30, 10:46 am, Romain Guy <romain...@google.com> wrote: > > > > I checked the history and the contacts live folder used to simply put > > > People.DATA in the cursor as the data for ICON_BITMAP. Try that. > > > > On Wed, Sep 30, 2009 at 10:37 AM, nEx.Software > > > > <email.nex.softw...@gmail.com> wrote: > > > > > I am beginning to wonder whether this is an issue with LiveFolders, or > > > > with the ContentProvider not passing the blob properly. I know for a > > > > fact that the data getting put into the MatrixCursor is able to be > > > > decoded when it goes in, but I don't think it is coming out the other > > > > side in the same way that it went in, thus causing the decodeByteArray > > > > call to fail and return null. > > > > > On Sep 30, 10:20 am, "nEx.Software" <email.nex.softw...@gmail.com> > > > > wrote: > > > >> I've done it that way too. Are you saying that I need to include those > > > >> columns and explicitly set them to null? > > > > >> On Sep 30, 10:16 am, Romain Guy <romain...@google.com> wrote: > > > > >> > I'm finally at the office and I just read the live folders code. The > > > >> > constraints are: > > > > >> > - If you use ICON_BITMAP, ICON_RESOURCE and ICON_PACKAGE *must* be > > > >> > null > > > >> > - The ICON_BITMAP has to be a Bitmap instance > > > > >> > Somehow the generated javadoc in the documentation does not show > > > >> > everything. If you look at the source code of LiveFolders.java you > > > >> > will see a lot more information about the columns and extras. > > > > >> > On Wed, Sep 30, 2009 at 10:09 AM, Romain Guy <romain...@google.com> > > > >> > wrote: > > > >> > > Oops, my bad I was thinking of something else. > > > > >> > > On Wed, Sep 30, 2009 at 9:51 AM, nEx.Software > > > >> > > <email.nex.softw...@gmail.com> wrote: > > > > >> > >> Well, I actually started off with just using the ICON_PACKAGE / > > > >> > >> ICON_RESOURCE method and wanted to use Photo instead. I have tried > > > >> > >> this without ICON_PACKAGE / ICON_RESOURCE to no avail. How do I > > > >> > >> specify the Icon type? > > > > >> > >> On Sep 30, 9:48 am, Romain Guy <romain...@google.com> wrote: > > > >> > >>> Why are you setting a bitmap and a resource for the icon? You > > > >> > >>> are also not > > > >> > >>> specifying the icon type. > > > > >> > >>> On Sep 30, 2009 9:44 AM, "nEx.Software" > > > >> > >>> <email.nex.softw...@gmail.com> > > > >> > >>> wrote: > > > > >> > >>> 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 <romain...@google.com> > > > >> > >>> wrote: > Oh > > > > >> > >>> yeah, ... > > > > >> > >>> > <email.nex.softw...@gmail.com> wrote: > > > The default > > > >> > >>> > contacts live > > > > >> > >>> folders don't pass photos fr... > > > > >> > > -- > > > >> > > Romain Guy > > > >> > > Android framework engineer > > > >> > > romain...@android.com > > > > >> > > 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 > > > >> > romain...@android.com > > > > >> > 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 > > > romain...@android.com > > > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---