I am new to android and was playing around with the makeText
method of Toast
class. I noticed that when calling makeText, I could not pass an integer for the duration parameter other than TOAST.LENGTH_LONG
and TOAST.LENGTH_SHORT
. Android studio warned that it has been annotated with @intDef
but when I opened the source code for Toast class, I couldn't find where the parameter was annotated. Any idea how this is enforced?
My target SDK version is API 19: Android 4.4 (KitKat)
. The signature is:
public static Toast makeText(Context context, CharSequence text, int duration)