Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT?

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?

like image 898
CoDe Avatar asked Aug 08 '11 22:08

CoDe


People also ask

What is toast Length_short?

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.

What is toast Length_long in android?

In general, a Toast can be displayed for either 2 seconds (Toast. LENGTH_SHORT) or 3.5 seconds (Toast. LENGTH_LONG).

What are the 2 constants of toast class when are they used?

The Toast class contains two predefined constants you can use: Toast. LENGTH_SHORT and Toast. LENGTH_LONG .

Can an android toast be longer than 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.


2 Answers

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.

like image 127
George Baker Avatar answered Oct 14 '22 04:10

George Baker


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.

like image 43
Zharf Avatar answered Oct 14 '22 04:10

Zharf