preeti
preeti

Reputation: 97

Sending multiple files via bluetooth

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);


    }

Upvotes: 3

Views: 1657

Answers (1)

Suraj Bajaj
Suraj Bajaj

Reputation: 6640

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

Upvotes: 1

Related Questions