I am printing Toast message in my application to show notification but i want to know value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT. What other values i can use.
Can anyone tell me what is the value of these two variables?
LENGTH_LONG. Show the view or text notification for a long period of time. int. LENGTH_SHORT. Show the view or text notification for a short period of time.
In general, a Toast can be displayed for either 2 seconds (Toast. LENGTH_SHORT) or 3.5 seconds (Toast. LENGTH_LONG).
The Toast class contains two predefined constants you can use: Toast. LENGTH_SHORT and Toast. LENGTH_LONG .
27 Answers. Show activity on this post. If you dig deeper in android code, you can find the lines that clearly indicate, that we cannot change the duration of Toast message.
There is another question that answers what you are looking for. The answers are:
private static final int LONG_DELAY = 3500; // 3.5 seconds private static final int SHORT_DELAY = 2000; // 2 seconds
This was courtesy of FeelGood. You can find the whole thread below.
Can an Android Toast be longer than Toast.LENGTH_LONG?
Hope this helps.
There are only these two constants related to Toast
http://developer.android.com/reference/android/widget/Toast.html#LENGTH_LONG
Why would you want to know their values though? You should always use the constants instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With