This is a fairly simple exercise, but it has to do with the cost! Sdcard.
Yes, you need to dump several files on the sdcard for this purpose.
For each file flushed to SDCard, you need to create a list of Uri arrays.
ArrayList<Uri> listDumpedFileUris = new ArrayList<Uri>(); Uri uriFile = Uri.fromFile(new File(dumpedFilePath)); listDumpedFileUris.add(uriFile);
The most important part is a direct indication of the intention that the selector should be able to read the dumped files on the SDCard by granting read permission and, more importantly, adding the list of arrays to an optional additional package.
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, listDumpedFileUris); startActivity(Intent.createChooser(intent, "Send these files using..."));
Then, all selected files will be sent via the Bluetooth runtime setting for Android. By the way, you may need to explicitly specify setType for files, for example, image/jpeg , as in:
intent.setType("image/jpeg");
The only thing on your part is to clear the remnants of the SDCard file system, which, by and large, is absolutely not suitable for Android users.
source share