I'm trying to share an image through an shareActionProvider, but every App I try to share the file with, seem not to take care of the file: the selected app will be open, but after that I don't see any image (i.e. skype opens itself but does not send any file at all)
Here is what I put in my onCreateOptionsMenu
:
getSupportMenuInflater().inflate(R.menu.menu_statistics, menu);
ShareActionProvider mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.actionbar_share_chart).getActionProvider();
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
String root= Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/charts");
String fname = "chart.png";
File file = new File(myDir, fname);
URI uri = file.toURI();
shareIntent.putExtra(Intent.EXTRA_STREAM, uri.toString());
mShareActionProvider.setShareIntent(shareIntent);
if(file.exists())
Log.d("debugCheck", "the file exists");
return true;
what I obtain is of course a
the file exists
in my logs. So, why is that? Why the app will be open but no images will be attached?