8

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??

khcpietro
  • 1,459
  • 2
  • 23
  • 42
  • 1
    I found that `Toast` works fine on emulator with Android Q. I think this is a bug of current version of Android. `Toast` won't work on device only. In my case, it was Pixel 3 XL. – khcpietro May 07 '19 at 09:42
  • I have had no problems with `Toast` working on a Pixel running Q (Beta 1 or Beta 2). – CommonsWare May 07 '19 at 10:56
  • https://stackoverflow.com/questions/73672191/why-toast-is-not-compatible-with-android-28/73676482#73676482 – ecle Sep 11 '22 at 03:15

2 Answers2

12

Rebooting device worked for me..

khcpietro
  • 1,459
  • 2
  • 23
  • 42
0

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.

Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60