else if(code == KeyEvent.KEYCODE_BLUETOOTH && !down) {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled())
mBluetoothAdapter.disable();
else
mBluetoothAdapter.enable();
}
在蓝牙打开时给个对话提示框提示,关闭时也给个提示,怎么解决?求大牛...给源码...
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled())
mBluetoothAdapter.disable();
else
mBluetoothAdapter.enable();
}
在蓝牙打开时给个对话提示框提示,关闭时也给个提示,怎么解决?求大牛...给源码...
if (mBluetoothAdapter.isEnabled()){
new Thread(new Runnable(){
public void run(){
showToast();
}
}).start(); Handler handler = new Handler();
public void showToast(){
handler.post(new Runnable(){
@Override
public void run(){
Toast.makeText(PhoneWindowManager.this, "closing bluetooth", Toast.LENGTH_SHORT).show();
System.out.println("closing bluetooth");
}
});
}
mBluetoothAdapter.disable();
}
这样不行啊 public void showToast() 非法的表达式开始