Ah I see, thanks.  A few notes in-line below:

On Apr 25, 6:31 pm, Dianne Hackborn <hack...@android.com> wrote:
> On Mon, Apr 25, 2011 at 2:27 PM, Paul <pmmen...@gmail.com> 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, that is *designed* around the approach I suggest.
>
> > 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, the share functionality will then make a
> > call to openFileDescriptor() which will call my overridden
> > openFile()... correct?
>
> Yes.
>
> > Anything special I need to do to trigger this workflow, other than the
> > standard:
>
> No that is the standard way it works.
>
> Intent share = new Intent(Intent.ACTION_SEND);
>
> > 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 value... any other
standard conventions that are recommended?  Store this as a static
constant in a static 'settings' class maybe?

>
> > share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(shareFileCopy));
> > startActivityForResult(Intent.createChooser(share, "Share"),
> > ACTIVITY_SHARE);
>
> ACTION_SEND is not specified to return anything, so if you are getting any
> result at all you can't count on what you get back being useful.

I'm not counting on it returning anything useful, just having the
functionality indicate that it has finished is enough, I am then
setting a boolean field to true when it does, so that I know I that
the app has created a temporary copy of the file in the app's cache
directory.  On exiting the program, if the field is true, I then empty
the cache directory.  Obviously don't need to do this if I am no
longer copying the file if/when I get the method you suggest using
onFile() to work.

On that front, I have overriden the onFile() method in my content
provider, but it is not being triggered by the above code, any
suggestions?

@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) {
  Log.d(LOG_TAG, "openFile() called");
  return null;
}

Paul

>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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