问题
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
??
回答1:
Rebooting device worked for me..
回答2:
As described in this Answer, make sure you haven't disabled notifications for the application. Go to App settings and see that notifications are enabled.
来源:https://stackoverflow.com/questions/56017928/toast-not-showing-in-android-q