问题
I am using below code to send a file via blue-tooth from one device to another. I want to send multiple file at the same time.Can anyone guide me how to parse multiple URI to file.I tried doing it with string tokenizer and while loop but in that case, by-default blue-tooth request is coming twice.(if there are two files parsing).
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);
}
回答1:
I use setAction(Intent.ACTION_SEND_MULTIPLE)
instead of setAction(Intent.ACTION_SEND)
to send (or share) multiple files.
It was asked 6 months ago, so don't know how relevant it is to you now. But may be it can help someone else. :)
来源:https://stackoverflow.com/questions/9957137/sending-multiple-files-via-bluetooth