I'm trying to create an android application. One part is to make sure that toast message shows. It works when I'm running the app on the android studio emulator, but it doesn't show when I'm running on actual Samsung phone
It's about a thousand line code, so I don't think it's helpful to copy all of it. So, I'd like to know if there is any common issues that can make toast messages to show in emulator but not in actual phone.
-- EDIT --
This is one of the parts where I want to toast message
private fun addListenerOnImageButtonHelper(intent: Intent, sensorId: Int, sensorType: Int, sensorTypeToString: String) {
findViewById<ImageButton>(sensorId).setOnClickListener {
if (sensorManager.getDefaultSensor(sensorType) != null) {
intent.putExtra("sensor", sensorType)
startActivity(intent)
} else {
Toast.makeText(this,
"$sensorTypeToString sensor is not available on this device",
Toast.LENGTH_LONG).show()
}
}
}
-- EDIT --
Phone's setting to show notification was turned off. Problem Solved... Thanks