开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜