Essential Android Intent edit forum

Sharing Multiple Files through Intent

The String List passed as a parameter to the share() method contains the paths of all the files you want to share.

It basically loops through the paths, adds them to Uri, and starts the Activity which can accept Files of this type.

public static void share(AppCompatActivity context,List<String> paths) {

      if (paths == null || paths.size() == 0) {
          return;
      }
      ArrayList<Uri> uris = new ArrayList<>();
      Intent intent = new Intent();
      intent.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
      intent.setType("*/*");
      for (String path : paths) {
              File file = new File(path);
              uris.add(Uri.fromFile(file));
      }
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
      context.startActivity(intent);
  }

Table Of Contents
6 Intent
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close