Images from sdcard not attached to email message
I am trying to attach a image from my filesystem on my samsung sIII
attached to eclipse
The following is the code :
String ccs[]={cc.getText().toString()};
String tos[]={to.getText().toString()};
Intent i=new Intent(Intent.ACTION_SEND_MULTIPLE);
i.putExtra(Intent.EXTRA_EMAIL, tos);
i.putExtra(Intent.EXTRA_CC, ccs);
i.putExtra(Intent.EXTRA_SUBJECT,"my mail");
i.setType("image/jpeg");
File ff=new File("/storage/sdcard0/DCIM/Camera/20130609_170758.jpg");
Uri u=null;
if(ff.exists())
{
Toast.makeText(this, "file is there", Toast.LENGTH_SHORT).show();
u=Uri.parse("file:///storage/sdcard0/DCIM/Camera/20130609_170758.jpg");
i.putExtra(Intent.EXTRA_STREAM,u);
}
else
Toast.makeText(this, "no such file", Toast.LENGTH_SHORT).show();
i.putExtra(Intent.EXTRA_TEXT, mess.getText().toString());
//i.setType("message/rfc822");
startActivity(i);
I am getting the toast that the file exists but the gmail app fails before
showing the screen for sending mail with attachment. I have also tried
Uri.fromFile but that is also not working. kindly update where i am making
mistake. thanks
No comments:
Post a Comment