In Android programming, what exactly is a Context class and what is it used for?
I read about it on the developer site, but I am unable to understand it
Context is an interface to global information about an application environment. It's an abstract class whose implementation is provided by the Android system.
Context allows access to application-specific resources and classes, as well as calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.
Here is Example
public class MyActivity extends Activity {
public void Testing() {
Context actContext = this; /*returns the Activity Context since Activity extends Context.*/
Context appContext = getApplicationContext(); /*returns the context of the single, global Application object of the current process. */
Button BtnShowAct1 = (Button) findViewById(R.id.btnGoToAct1);
Context BtnContext = BtnShowAct1.getContext(); /*returns the context of the View. */
For more details you can visit http://developer.android.com/reference/android/content/Context.html