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.
Ca
LENGTH_SHORT & LENGTH_LONG are mapped to time interval of 1 Second (1000mS) & 5 Seconds (5000mS) respectively,
To see this you need to dig into the AOSP source code of Toast
. You can see in the Toast class time interval is decided based on the FLAG
mParams.hideTimeoutMilliseconds = mDuration == Toast.LENGTH_LONG ? LONG_DURATION_TIMEOUT : SHORT_DURATION_TIMEOUT;
where
static final long SHORT_DURATION_TIMEOUT = 5000;
static final long LONG_DURATION_TIMEOUT = 1000;
Reference: https://android.googlesource.com/platform/frameworks/base/+/f4bed684c939b0f8809ef404b8609fe4ef849263/core/java/android/widget/Toast.java