Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.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
Java Android蓝牙意图_Java_Android_User Interface_Bluetooth_File Transfer - Fatal编程技术网

Java Android蓝牙意图

Java Android蓝牙意图,java,android,user-interface,bluetooth,file-transfer,Java,Android,User Interface,Bluetooth,File Transfer,我想通过我的代码发送一个文件。我知道文件路径,我想通过蓝牙来实现。当我调用此意图时,它会显示一个弹出窗口,询问我是否希望通过蓝牙、gmail、facebook等发送文件 Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_STREAM, Uri.parse(path)); startActivity(Intent.createChoose

我想通过我的代码发送一个文件。我知道文件路径,我想通过蓝牙来实现。当我调用此意图时,它会显示一个弹出窗口,询问我是否希望通过蓝牙、gmail、facebook等发送文件

   Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain");    
   i.putExtra(Intent.EXTRA_STREAM, Uri.parse(path)); 
   startActivity(Intent.createChooser(i, "Send File"));
有没有办法跳过这个弹出步骤,并指定我想一直通过蓝牙来完成


另外,如果我知道要发送到的蓝牙设备的地址,有没有办法通过intent中的代码来指定该地址?

也许你可以试试这个代码,它对我很有用!它只会在您需要时选择蓝牙 想要

intent.setPackage("com.android.bluetooth");