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,267
  • 2
  • 19
  • 39
  • 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

2 Answers2

11

Rebooting device worked for me..

khcpietro
  • 1,267
  • 2
  • 19
  • 39
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,199
  • 6
  • 33
  • 57