I am creating a application where i want to send captured image as an attachment to email body but not able to achieve above.Can anyone please guide me.
emailsend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i("Send email", "");
String[] TO = {""};
String[] CC = {""};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("application/image");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(pic));
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(clickimages.this, "There is no email client installed.", Toast.LENGTH_SHORT).show();
}
}
});'