I get an image from a PHP server as a string (this image), and I want to send this image by e-mail as a attachment.
When I try to send e-mail, then the attachment is papers but only plain text is displaying at the receiver end. How do I send the e-mail correctly?
This is my code:
Intent picMessageIntent = new Intent(android.content.Intent.ACTION_SEND);
picMessageIntent.setType("image/jpeg");
String img_source = listBuzzInfoBean.get(photo).getBuzzImage();
File downloadedPic = new File(Environment.getExternalStorageDirectory(), img_source + ".jpg");// Art_Nature
Log.d("++++++++++++++", img_source);
Uri myUri = Uri.fromFile(downloadedPic);
picMessageIntent.putExtra(Intent.EXTRA_STREAM, myUri); //screenshotUri
startActivity(Intent.createChooser(picMessageIntent, "Share image using"));
I used the following code to handle this. I have noticed that differences between Gmail/Mail apps and how they handle this intent.
Also this post seems to have a similar problem.
Android: Intent.ACTION_SEND with EXTRA_STREAM doesn't attach any image when choosing Gmail app on htc Hero