• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Delay thread android W/ Toast

Ofirst99

Lurker
Hello,

I want to use the constant of “Toast” in the delay.

When I write a number it fine, but when I use for example "Toast.LENGTH_LONG", it immediately execute the code in side it, and does not wait as I wanted.

Thanks
 

Attachments

  • Screen Shot 2017-07-02 at 13.13.12.png
    Screen Shot 2017-07-02 at 13.13.12.png
    44.9 KB · Views: 159
Because the value of Toast.LENGTH_LONG is 1.
So you are passing a value of 1 millisecond as the 2nd parameter to the postDelayed() method.
1 millisecond isn't a very long period of time ;)
 
Back
Top Bottom