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, 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.android/android-apps/2.0_r1/com/android/mms/ui/UriImage.java#UriImage.initFromContentUri%28android.content.Context%2Candroid.net.Uri%29

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<[email protected]>  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 [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

Reply via email to