Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中使用蓝牙以编程方式发送多个文件_Android_Bluetooth_Data Transfer - Fatal编程技术网

在android中使用蓝牙以编程方式发送多个文件

在android中使用蓝牙以编程方式发送多个文件,android,bluetooth,data-transfer,Android,Bluetooth,Data Transfer,我正在开发一个android应用程序,它将通过蓝牙连接将多个图像文件传输到另一个移动设备 我在android中使用了以下传输方法: ArrayList<Uri> uris=new ArrayList<Uri>(); String multifile[]={"/sdcard/aaa.txt","/sdcard/bbb.txt","/sdcard/ccc.txt"}; int len=multifile.length; Intent Int=new Intent(); Int

我正在开发一个android应用程序,它将通过蓝牙连接将多个图像文件传输到另一个移动设备

我在android中使用了以下传输方法:

ArrayList<Uri> uris=new ArrayList<Uri>();
String multifile[]={"/sdcard/aaa.txt","/sdcard/bbb.txt","/sdcard/ccc.txt"};
int len=multifile.length;
Intent Int=new Intent();
Int.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
Int.setType("*/*");
for(int i=0;i<len;i++)
{
File file=new File(multifile[i]);
uris.add(Uri.fromFile(file));
}
Int.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Int);
arraylisturis=newarraylist();
字符串多文件[]={/sdcard/aaa.txt“,“/sdcard/bbb.txt”,“/sdcard/ccc.txt”};
int len=多文件长度;
Intent Int=新Intent();
Int.setAction(android.content.Intent.ACTION\u SEND\u MULTIPLE);
Int.setType(“*/*”);
对于(int i=0;i这对我来说很有效:

使用
putExtra(Intent.EXTRA\u STREAM,uri)代替
putParcelableArrayListExtra

它是一个月前提出的,所以不知道它对您有多重要,但可能对其他人有帮助。

ArrayList uris=new ArrayList();
mul=文件选择器列表;
日志d(“最终”和“+mul”);
int length=mul.size();
//Toast.makeText(ImageActivity.this,“Send”,Toast.LENGTH_LONG.show();
//mail_int.setAction(android.content.Intent.ACTION_视图);
mail_int.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
//邮件int.setAction(android.content.Intent.ACTION\u TIME\u已更改);
mail_int.setType(“image/*”);
for(int i=0;i
ArrayList<Uri> uris = new ArrayList<Uri>();
        mul = fileSelectorList;
         Log.d("final",""+mul);
        int length = mul.size();

        //Toast.makeText(ImageActivity.this, "Send", Toast.LENGTH_LONG).show();
        //mail_int.setAction(android.content.Intent.ACTION_VIEW);
        mail_int.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
    //mail_int.setAction(android.content.Intent.ACTION_TIME_CHANGED);
        mail_int.setType("image/*");
        for(int i = 0; i < length; i++) {
            File file = new File(mul.get(i));
            uris.add(Uri.fromFile(file));

        }

        mail_int.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        startActivity(mail_int);