Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.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 4.0.3和4.0.4 lenovo选项卡中不起作用_Android - Fatal编程技术网

蓝牙代码在Android 4.0.3和4.0.4 lenovo选项卡中不起作用

蓝牙代码在Android 4.0.3和4.0.4 lenovo选项卡中不起作用,android,Android,我的代码 你到底想做什么?不确定,因为文件和位置的事情,我不清楚 如果您只想打开蓝牙设置,这段代码应该可以帮您: public void onClick(View v) { String pos = applist.get(arg0); File f = new File(path + pos); Uri path = Uri.fromFile(f); Intent intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS); i

我的代码


你到底想做什么?不确定,因为文件和位置的事情,我不清楚

如果您只想打开蓝牙设置,这段代码应该可以帮您:

public void onClick(View v) 
{

 String pos = applist.get(arg0);
 File f = new File(path + pos);
 Uri path = Uri.fromFile(f);
 Intent intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
 intent.setAction(Intent.ACTION_SEND);
 intent.putExtra(Intent.EXTRA_STREAM, path);
 intent.setType("text/plain");
 intent.setPackage("com.android.bluetooth");
 startActivity(intent);

}
这应该足够了

希望我能帮忙。享受

Intent intentOpenBluetoothSettings = new Intent();
intentOpenBluetoothSettings.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS); 
startActivity(intentOpenBluetoothSettings);