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 .exec(), I asked about spaces in
filenames.  I was told not to use this method, but to use the content
provider, but that only gets called if I move away from the file: uri
to the content: uri... but using a content provider, the share/send
seems to be expecting some kind of database implementation.

Should I be looking for the file-specific uri in query() (those that
end with .png), and if that hits, then create and return a cursor that
contains the needed columns, fn, _data?

Thanks,

Paul

On Apr 26, 11:42 am, Kostya Vasilyev <kmans...@gmail.com> wrote:
> 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.Me...
>
> using ContentResolver, which will direct the query back to your
> ContentProvider's query method.
>
> Looks like the MMS application also wants to get the actual filename
> (the _data column).
>
> -- Kostya
>
> 26.04.2011 19:29, 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(StylePad.DEFAULT_MIME_PNG);
> > share.putExtra(Intent.EXTRA_STREAM, validUri);
> > startActivity(Intent.createChooser(share,
> > getString(R.string.activity_title_share)));
>
> > I am now getting a IllegalArgumentException thrown, and my openFile/
> > openAssetFile never gets called (the Exception is hitting before it
> > would get there I guess).  Here is the Exception:
>
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):
> > java.lang.IllegalArgumentException: column '_data' does not exist
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:
> > 314)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:
> > 99)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.UriImage.initFromContentUri(UriImage.java:160)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.UriImage.<init>(UriImage.java:90)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.MMSMessage.addImage(MMSMessage.java:1076)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.ConversationList.addMedia(ConversationList.java:
> > 7095)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.ConversationList.addAttachment(ConversationList.java:
> > 8370)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.ConversationList.handleIntent(ConversationList.java:
> > 1860)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.ConversationList.access$2800(ConversationList.java:
> > 180)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.mms.ui.ConversationList
> > $ThreadListQueryHandler.onQueryComplete(ConversationList.java:2999)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > android.content.AsyncQueryHandler.handleMessage(AsyncQueryHandler.java:
> > 344)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > android.os.Looper.loop(Looper.java:123)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > android.app.ActivityThread.main(ActivityThread.java:4627)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > java.lang.reflect.Method.invoke(Method.java:521)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:871)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
> > 04-26 11:12:54.322: ERROR/AndroidRuntime(12440):     at
> > dalvik.system.NativeStart.main(Native Method)
>
> > Looking at the source:
> >http://grepcode.com/file/repository.grepcode.com/java/ext/com.google....
>
> > So the Send functionality is querying my Provider's query() method,
> > which I can see, but it is looking for two columns that I simply don't
> > have, Part.FILENAME (column fn) and then if not found, column
> > Part._DATA (column _data).
>
> > Any ideas how to respond to this?
>
> > On Apr 26, 3:30 am, Kostya Vasilyev<kmans...@gmail.com>  wrote:
> >> 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 Uri which points to your
> >> provider's authority.
>
> >> -- Kostya
>
> >> 26.04.2011 6:04, Paul пишет:
>
> >>> <provider
> >>>               android:name=".provider.MyProvider"
> >>>               android:authorities="package.name.here"
> >>>               android:exported="true" />
> >>> I am using it for all DB activity in my app, so it's working... and
> >>> have tried the following, and no errors are generated:
> >>> getContentResolver().openFileDescriptor(Uri.fromFile(shareFile), "r");
> >>> But... this does not trigger a call to openFile().
> >> --
> >> Kostya Vasilyev --http://kmansoft.wordpress.com
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com

-- 
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

Reply via email to