package ve.gob.cenditel.tibisaymovil; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import android.content.Intent; import android.net.Uri; /** * Utilities to create some {@link Intent}s used in the application. * * @author José M. Prieto (jmprieto@emergya.com) */ public class IntentUtils { /** * Send a file as an email attachment. * * @param file the File to be sent * @return the Intent */ public static Intent sendFile(File file) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); return intent; } /** * Send multiple files as email attachments. * * @param files an array of File's to be sent * @return the Intent */ public static Intent sendMultipleFiles(File[] files) { Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("message/rfc822"); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, TypeUtils.convertToUriArrayList(Arrays.asList(files))); return intent; } public static Intent sendMultipleFiles(ArrayList files) { Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("message/rfc822"); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files); return intent; } }