The context class in Android is known as an
interface to global information about a certain application environment.
It is declared as an abstract class where implementation is offered by the Android Operating System. Context allows access to the application-specific resources and classes and up-calls for the application-level operations like launching activities, receiving intents, broadcasting, etc. Here is an example in which the abstract method getAssets is implemented from the Context class as follows-
@Override
public AssetManager getAssets() {
return mBase.getAssets();
}
where 'mBase' is a fieldset by the constructor to a certain context.
There are several ways of getting context-
getContext()
getBaseContext()
getApplicationContext()
this