I am trying to create a “publish” button for an image in my Android application that works with a Facebook application and email.
This is my code (imagePath is something like "/sdcard/myapp/image.jpg"
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+imagePath));
sendIntent.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo");
startActivity(Intent.createChooser(sendIntent, "Email:"));
This works great for sending email with the app, but it doesn't work with the Facebook app. If i use
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imagePath));
Facebook posting works, but email attachment is no longer sent.
Any ideas what can be done for both?
source
share