蓝牙代码在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);