In Android, what is context ( one of the parameter in toast)why we use this keyword as context? plz explain
i have tried on google but not getting answer.. i m using kotlin language in android.
In Android, what is context ( one of the parameter in toast)why we use this keyword as context? plz explain
i have tried on google but not getting answer.. i m using kotlin language in android.
Refer to wiki , a context is the minimal set of data for a task to run.
In some programming architecture, a context always acts the role of an environment which linking up-stream and down-stream (or back-end and front-end).
In android, a Context is the interface to global information about an application environment.The global information includes resources and apis to get system services(getSystemService(..)
).
A context contains the necessay environment for an app to do something.
The android's contex may be an Activity, a Service, or an Application.
For a Toast
, it needs a context to get text from Resources
and get a system service (NotificationManager
) to show the text.