im试图用蓝牙连接编写应用程序,当我收到有关打开蓝牙的请求时,我必须选择是或否,当我这样做时,它应该显示像吐司的小消息,但它不显示,我试图进行功能内部烘烤,如果仍然无法正常工作,请帮助
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.DefaultAdapter;
if (bluetoothAdapter == null)
{
Toast.MakeText(Application.Context, "xxx ", ToastLength.Short).Show();
}
if (!bluetoothAdapter.IsEnabled)
{
Intent wlaczbt = new Intent(BluetoothAdapter.ActionRequestEnable);
StartActivityForResult(wlaczbt, REQUEST_ENABLE_BT);
//OnActivityResult(REQUEST_ENABLE_BT, Result.Ok, wlaczbt);
}
else
{
Toast.MakeText(Application.Context, "xxx ", ToastLength.Short).Show();
}
OnActivity:
public void OnActivityResult(int requestCode,int resultCode,Intent data)
{
base.OnActivityResult(requestCode, Result.Ok , data);
Toast.MakeText(Application.Context, "xx ", ToastLength.Short).Show();
if (requestCode == REQUEST_ENABLE_BT)
{
if(resultCode.Equals(Result.Ok))
{
Toast.MakeText(Application.Context, "xx ",ToastLength.Short).Show();
}
else
{
Toast.MakeText(Application.Context, "xx ", ToastLength.Short).Show();
}
}
}