I want to send email with multiple attachment in android i got solution for that but now the problem is that i have 2 files one in SDCard and other in local directory of android i.e Drawable folder. I have done with coding while sending email it is showing both attachment but i am receiving only one attachment which is present in SDcard i am not able to get the attachment from internal folder i.e drawable. Below is my code please help me to solve this.
public class TransmitAgreement extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transmit_agreement);
String addressLine = gpsTracker.getAddressLine(this);
String emailaddress = "myemail";
String message = "Msg"
String subject = "sbj";
Intent emailIntent = new Intent(
android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { emailaddress });
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, message);
ArrayList<Uri> uris = new ArrayList<Uri>();
// convert from paths to Android friendly Parcelable Uri's
String[] filePaths = new String[] {
"android.resource://com.example.freenup/" + R.drawable.freenup_app_agreement,
"sdcard/saved_images/MyImage.png" };
for (String file : filePaths) {
File fileIn = new File(file);
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.transmit_agreement, menu);
return true;
}
}
I have tried with other solution too but getting same problem. I am only geeting one attachment in email...