I use a ShareActionProvider
to share images generated by my app.
The thing is: I write a temporary image file to disk for the sole purpose of sharing - the shared image is a composition of multiple bitmaps on the screen, let's say in my own function createComposition(Bitmap bitmap1, Bitmap bitmap2)
. Right now, I run createComposition(b1, b2)
every time that content changes, so that any possible share will result in a correct image being shared, but this leads to a lot of cpu cycles (and disk writes) wasted, because most content changes won't result in a share.
So I would rather create this temporary file after the user has clicked the share button, so that I don't have to generate a potentially useless image on disk every time the on-screen content changes. Question: how do I get there? Is there a listener for the ShareActionProvider
? onOptionsItemSelected
doesn't go off, anyway.
Do I need to extend ShareActionProvider
, maybe?
OnShareTargetSelected Appears to be what you are looking for.