Toast
does not work in Android Q. Is there any change on Toast
? I couldn't find any release note for Toast
.
My code is simple.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Toast.makeText(this, "onCreate", Toast.LENGTH_SHORT).show()
}
fun onButtonClick(view: View) {
Toast.makeText(this, "onButtonClick", Toast.LENGTH_SHORT).show()
}
This works fine with Android Pie, but no luck with Android Q.
What happened to Toast
??
Display the created Toast Message using the show() method of the Toast class. The code to show the Toast message: Toast. makeText(getApplicationContext(), "This a toast message", Toast.
A standard toast notification appears near the bottom of the screen, centered horizontally. You can change this position with the setGravity(int, int, int) method. This accepts three parameters: a Gravity constant, an x-position offset, and a y-position offset.
A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout.
Rebooting device worked for me..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With