send Mail Attached Multi Files using Intent - Android Intent

Android examples for Intent:Send Email

Description

send Mail Attached Multi Files using Intent

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import java.util.ArrayList;

public class Main {
    public static void sendMailAttachedMultiFiles(Context context,
            String email, String subject, ArrayList<Uri> uriFileList) {
        Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
        sendIntent.setType("application/pdf");
        sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { email });
        sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
        sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
                uriFileList);//from w w w. j a  v  a2  s  .  c  o  m
        sendIntent.putExtra(Intent.EXTRA_TEXT, "");
        context.startActivity(sendIntent);
    }
}

Related Tutorials