Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Dianne Hackborn
As mentioned, use a MatrixCursor: http://developer.android.com/reference/android/database/MatrixCursor.html Or you can derive directly from AbstractCursor and implement the full Cursor API if you want... more work, but ultimately would probably be a more efficient implementation. And actually f

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Paul
Ok, so the UriImage code IS expecting a Cursor that contains two columns, _data and mime_type. Silly question maybe, but how do I create a Cursor containing these columns from a static PNG file without storing the corresponding data in a database? I am now handling the Uri for the image (content:

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Paul
Thanks Kostya. My app actually DOES use a SQLite DB as well for other functionality that makes use of the content provider, but like you mention, with a custom Uri I can match against a known set and handle the file requests as needed. I am assuming that once I handle this query() issue, then ope

Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Kostya Vasilyev
26.04.2011 19:53, Paul пишет: Right, but in my case I am dealing with a physical file, not data stored in a database. I have physical .png files located in the applications /files directory that I want to be able to send/share. A ContentProvider doesn't have to be backed by a database. Since

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Paul
Right, but in my case I am dealing with a physical file, not data stored in a database. I have physical .png files located in the applications /files directory that I want to be able to send/share. As I was originally copying the file over to the cache directory and making them world readable via

Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Kostya Vasilyev
Right. Any sane application dealing with a content:// URI will want to know the data item's title and size (at least). It would do that by querying the URI for columns, defined here: http://developer.android.com/reference/android/provider/MediaStore.MediaColumns.html using ContentResolver, w

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Paul
That did it when it comes to my own call to: getContentResolver().openFileDescriptor(validUri, "r"); It is now calling openAssetFile() in my content provider. However, in the usage of the send functionality with the content://... uri: Intent share = new Intent(Intent.ACTION_SEND); share.setType

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Paul
That did it when it comes to my own call to: getContentResolver().openFileDescriptor(validUri, "r"); It is now calling openAssetFile() in my content provider. However, in the usage of the send functionality with the content://... uri: Intent share = new Intent(Intent.ACTION_SEND); share.setType

Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-26 Thread Kostya Vasilyev
Paul, Don't know if this is a typo, but - you have Uri.fromFile in the code quoted below. That method makes a file:// Uri, which has nothing to do with your content provider (or any other) - and that's why you are not seeing a call to your openFile. You need to construct a content:// scheme

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Paul
Thanks - my implementation looks correct, so no idea why it's not being called. Tried tracing the call to getContentResolver().openFileDescriptor() and it seemed to be invoking openAssetFileDescriptor(), so intercepted openAssetFile() in my content provider, but it too isn't being called. On Apr

Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Dianne Hackborn
I don't know if it will help, but here is the source to the media provider which implements openFile: http://android.git.kernel.org/?p=platform/packages/providers/MediaProvider.git;a=blob;f=src/com/android/providers/media/MediaProvider.java;h=7a72e239b0291e6b2ef986c4f675d58dfcda0732;hb=HEAD This

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Paul
On Apr 25, 8:55 pm, Dianne Hackborn wrote: > On Tue, Apr 26, 2011 at 12:46 AM, Paul wrote: > > > > share.setType(getString(R.string.note_default_mime_png)); > > > There is no reason for this string to come from a resource; it is not > > > something that gets localized, it is just a constant. > >

Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Dianne Hackborn
On Tue, Apr 26, 2011 at 12:46 AM, Paul wrote: > > > share.setType(getString(R.string.note_default_mime_png)); > > There is no reason for this string to come from a resource; it is not > > something that gets localized, it is just a constant. > I am storing it in the XML as a way of storing the va

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Paul
Ah I see, thanks. A few notes in-line below: On Apr 25, 6:31 pm, Dianne Hackborn wrote: > On Mon, Apr 25, 2011 at 2:27 PM, Paul wrote: > > So just to clarify (as I have no access to the other app and what it > > calls, in this case the other app is the OS-standard 'share/send' > > functionality

Re: [android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Dianne Hackborn
On Mon, Apr 25, 2011 at 2:27 PM, Paul wrote: > So just to clarify (as I have no access to the other app and what it > calls, in this case the other app is the OS-standard 'share/send' > functionality), Share/send is not an app. It is a convention for applications to interact with each other, t

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-25 Thread Paul
So just to clarify (as I have no access to the other app and what it calls, in this case the other app is the OS-standard 'share/send' functionality), I override the openFile() method in my app's content provider, and then when I trigger the 'share' functionality and pass it in the Uri to the file,

[android-developers] Re: Problem setting file permissions when filename has a space

2011-04-23 Thread Maps.Huge.Info
Have you tried escaping the space? path/to/file\ name.png -John Coryat -- 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