我正在使用以下代码从一个设备通过蓝牙发送文件到另一个设备。我想同时发送多个文件。有人可以指导我如何解析多个URI到文件吗?我尝试使用字符串分词器和while循环来实现,但在这种情况下,如果有两个文件解析,那么默认的蓝牙请求会出现两次。
StringTokenizer tokens = new StringTokenizer(music, ",");
String stored = "";
while (tokens.hasMoreTokens()) {
stored = tokens.nextToken();
File file = new File(stored);
Log.d("file===", stored);
intentfile = new Intent();
intentfile.setAction(android.content.Intent.ACTION_SEND);
intentfile.setType("video/*");
intentfile.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivityForResult(intentfile, SEND_REQUEST);
}