Image Email Attachment in Android doesn't open in right format
I've been trying since 2 hours, to find the code to email an image in Android. At least i was successful, but still have a problem. When i email the image, it ope开发者_开发百科ns as text file, and not as jpeg
. I also used MIME type (image/jpeg)
, but in vain. Please help me with this.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/jpg");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,e2.getText().toString());
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{e1.getText().toString()});
emailIntent.setType("image/jpg");
Uri path = Uri.parse("android.resource://com.mypackage.name/drawable/" + filename);
emailIntent.setType("image/jpg");
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
emailIntent.setType("image/jpeg");
startActivity(Intent.createChooser(emailIntent, "Send Email"));
Any help will be appreciated.
Thank you!
For those who need help, just copy the image to sdcard, and then attach! It works!
精彩评论