On Thu, Sep 3, 2009 at 7:13 AM, David Given<d...@cowlark.com> wrote: > > I would like my app to start an email app such as GMail with an attached > file. > > For various technical reasons we can't use a file: URL for this --- we > have to pull the file out of our ContentProvider. So, I need some way to > make a content: URL behave as if it were a file.
You can implement openFile() in your content provider to return a FileDescriptor for that content Uri. This is what pretty much every content provider does for things like this. > We've got it *nearly* working; I can see GMail call query() on my > ContentProvider, followed shortly by GMail crashing because I'm not > providing the right fields in the cursor. A Cursor is not a file, so not sure what you're trying to do here. > The thing is --- what's GMail expecting to see? I can't find any > documentation on this. I have found ContentProvider#getAssetFile(), > which appears to be related, but it doesn't seem to being called. What I > get is: > > E/CursorWindow( 848): Bad request for field slot 0,1. numRows = 1, > numColumns = 1 Something is trying to get the 2nd column from a Cursor that has only 1 column. > (What I'd really like to do is to be able to pass GMail some sort of > high-level stream object so that I can generate data on the fly, but I > suspect it's not possible.) > > -- > ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── > │ > │ "They laughed at Newton. They laughed at Einstein. Of course, they > │ also laughed at Bozo the Clown." --- Carl Sagan > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---