else if(code == KeyEvent.KEYCODE_BLUETOOTH && !down) {
                BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
                if (mBluetoothAdapter.isEnabled())
                    mBluetoothAdapter.disable();
                else
                    mBluetoothAdapter.enable();
            }
在蓝牙打开时给个对话提示框提示,关闭时也给个提示,怎么解决?求大牛...给源码...

解决方案 »

  1.   

    JOptionPane.showMessageDialog 莫非是这种弹出框?我也才刚学的,不知道对不对,呵呵
      

  2.   

    要 android 中 自动弹出的 
      

  3.   


    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() 非法的表达式开始