source: dispositivos_moviles/TibisayMovil/src/ve/gob/cenditel/tibisaymovil/IntentUtils.java @ 37c4d43

Last change on this file since 37c4d43 was 288126d, checked in by Jose Ruiz <joseruiz@…>, 11 years ago

Manejo de repositorio de certificados y firma con pkcs7

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package ve.gob.cenditel.tibisaymovil;
2
3import java.io.File;
4import java.util.ArrayList;
5import java.util.Arrays;
6
7import android.content.Intent;
8import android.net.Uri;
9
10/**
11 * Utilities to create some {@link Intent}s used in the application.
12 *
13 * @author José M. Prieto (jmprieto@emergya.com)
14 */
15public class IntentUtils {
16
17    /**
18     * Send a file as an email attachment.
19     *
20     * @param file the File to be sent
21     * @return the Intent
22     */
23    public static Intent sendFile(File file) {
24        Intent intent = new Intent(Intent.ACTION_SEND);
25        intent.setType("message/rfc822");
26        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
27        return intent;
28    }
29
30    /**
31     * Send multiple files as email attachments.
32     *
33     * @param files an array of File's to be sent
34     * @return the Intent
35     */
36    public static Intent sendMultipleFiles(File[] files) {
37        Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
38        intent.setType("message/rfc822");
39        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, TypeUtils.convertToUriArrayList(Arrays.asList(files)));
40        return intent;
41    }
42
43    public static Intent sendMultipleFiles(ArrayList<Uri> files) {
44        Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
45        intent.setType("message/rfc822");
46        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);
47        return intent;
48    }
49}
Note: See TracBrowser for help on using the repository browser.