1. Are you ready for the Galaxy S20? Here is everything we know so far!

Delay thread android W/ Toast

Discussion in 'Android Development' started by Ofirst99, Jul 2, 2017.

  1. Ofirst99

    Ofirst99 Lurker
    Thread Starter

    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
     

    Attached Files:



  2. Best Answer:
    Post #2 by Deleted User, Jul 2, 2017 (1 points)

    1. Download the Forums for Android™ app!


      Download

       
  3. Deleted User

    Deleted User Guest

    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 ;)
     
    Ofirst99 likes this.
  4. Ofirst99

    Ofirst99 Lurker
    Thread Starter

    thanks
     
Loading...

Share This Page

Loading...