I am trying to attach multiple images to an email.
I have tried the next code, but I don`t know what I am doing wrong.
I need to call the images by the Integer Array that you will see and attach them to an email.
Some of the class look like this:
Integer[] images = {
R.drawable.image1,
R.drawable.image2,
R.drawable.image3,
R.drawable.image4 };
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.bSendEmail:
Intent emailintent2 = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailintent2.setType("plain/text");
emailintent2.putExtra(Intent.EXTRA_EMAIL, emailaddress2);
emailintent2.putExtra(Intent.EXTRA_SUBJECT, corsub);
emailintent2.putExtra(Intent.EXTRA_TEXT, message2);
ArrayList<Uri> uris = new ArrayList<Uri>();
uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + images[0]));
uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + images[1]));
uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + images[2]));
uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + images[3]));
emailintent2.putExtra(Intent.EXTRA_STREAM, uris);
startActivity(emailintent2);
break;