小编use*_*853的帖子

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

我正在开发一个 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);
Run Code Online (Sandbox Code Playgroud)

这种方法成功传输了文件。但我在 android 手机上只有 9 张图像,然后我的应用程序将传输另一组 9 张图像,为此我必须调用上面的选择器向导来发送文件。但我不希望用户再次从选择器中选择选项。

有没有办法通过该选项(来自向导的蓝牙)静默(无需用户干预)发送文件?

android data-transfer bluetooth

5
推荐指数
1
解决办法
3882
查看次数

标签 统计

android ×1

bluetooth ×1

data-transfer ×1