Toast.makeText(context, text, duration);
getApplicationContext()
- Returns the context for all activities running in application.
getBaseContext()
- If you want to access Context from another context within application you can access.
getContext()
- Returns the context view only current running activity.
text
- Return "STRING" , If not string you can use type cast.
(string)num // type caste
Toast.LENGTH_SHORT
- Toast delay 2000 ms predefined
Toast.LENGTH_LONG
- Toast delay 3500 ms predefined
milisecond
- Toast delay user defined miliseconds (eg. 4000)
Example.1
Toast.makeText(getApplicationContext(), "STRING MESSAGE", Toast.LENGTH_LONG).show();
Example.2
Toast.makeText(getApplicationContext(), "STRING MESSAGE", 5000).show();