gpt4 book ai didi

java - Toast 消息不显示?

转载 作者:行者123 更新时间:2023-12-01 16:54:31 25 4
gpt4 key购买 nike

我正在尝试为应用程序提供蓝牙连接,当蓝牙打开时,它不会显示 toast 消息

if (!bluetoothAdapter.isEnabled()) {

Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);

startActivityForResult(intent, 1);
Toast.makeText(HeartRate.this, "Turned on", Toast.LENGTH_LONG);
}

最佳答案

你忘记了什么

 if (!bluetoothAdapter.isEnabled()) {

Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);

startActivityForResult(intent, 1);
//.show happens a lot of times to me
Toast.makeText(HeartRate.this, "Turned on", Toast.LENGTH_LONG).show();
}

关于java - Toast 消息不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61615146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com