I am trying to open a .png file located in the application / data directory via ContentProvider, but instead of accessing the method openFile, it is being called query. Now I have only one image that I need to provide for sharing in other applications, how to set my intent to goto openFileinstead query?
Intent shareImageIntent = new Intent(Intent.ACTION_SEND);
shareImageIntent.setType("image/*");
shareImageIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
startActivity(Intent.createChooser(shareImageIntent, "Share image"));
Where Uri looks like
content:
Or, conversely, do I need to create a database for this and return the cursor?
UPDATE
So, it looks like this works on everything except the SMS application (this is what I decided to test first), but I would like to support its sharing.
Here's the corresponding stack trace:
: java.lang.IllegalArgumentException: content://mypackage.myprovider/someImage.png . com.android.mms.ui.UriImage.initFromContentUri(UriImage.java:104) at com.android.mms.ui.UriImage. (UriImage.java:63) at com.android.mms.model.ImageModel.initModelFromUri(ImageModel.java:83) com.android.mms.model.ImageModel. (ImageModel.java:65) com.android.mms.data.WorkingMessage.changeMedia(WorkingMessage.java:481) com.android.mms.data.WorkingMessage.setAttachment(WorkingMessage.java:375)...
, SMS openFile, , , ( Google)
- , , , ? AOSP.