Sending multiple files via bluetooth

2019-07-03 23:40发布

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条回答
该账号已被封号
2楼-- · 2019-07-04 00:03

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. :)

查看更多
登录 后发表回答