Bluetooth接続を作成するチェックボックスが1つあります。問題は、Bluetooth パーミッション リクエスト ダイアログ ボックスが表示され、[ ] を選択するNo
と、チェックボックスがオンのままになることです。
このアクティビティからリクエストコードを取得し、取得した場合にチェックボックスをオフにするにはどうすればよいRESULT_CANCELED
ですか?
CheckBox turnBtOnOff=(CheckBox)findViewById(R.id.checkBox1);
turnBtOnOff.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if (isChecked)
{
if(!mBluetoothAdapter.isEnabled())
{
Intent enableBtIntent=new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
//myAddress=mBluetoothAdapter.getAddress();
//Toast.makeText(getBaseContext(), myAddress, Toast.LENGTH_SHORT).show();
}
}
else
{
if(mBluetoothAdapter.isEnabled())
{
mBluetoothAdapter.disable();
}
}
}
});