I am trying to give an application, Bluetooth connectivity when the Bluetooth is turned on it does not show the toast message
if (!bluetoothAdapter.isEnabled()) {
Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(intent, 1);
Toast.makeText(HeartRate.this, "Turned on", Toast.LENGTH_LONG);
}
you forgot something
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();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.