9

Possible Duplicate:
What is Context in Android?

I would like to know what exactly Android's Context is, and why it is needed. I know it's related to class and each class has a unique context. I have seen in some code which passes a Context when calling methods of another class. I don't understand why it is needed. Please help.

Community
  • 1
  • 1
Droidme
  • 1,223
  • 6
  • 25
  • 45

3 Answers3

1

a Context is:

Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.

Ref: http://developer.android.com/reference/android/content/Context.html

Johnny
  • 6,239
  • 7
  • 29
  • 36
1

All classes does not have an android context. Their is an application context, and activity c contexts. A context is used for a lot of things, but most often it is just to load and access resources.

See: http://developer.android.com/reference/android/content/Context.html for more info.

softcharles
  • 102
  • 1
0

The android context holds information about your application's environment.

You might want to take a look at the official reference in order to understand which information is being held by your context and what operations you can do with it.

Ham Vocke
  • 2,942
  • 22
  • 27