Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Please explain me Context class in Android

I'm new to Android. Can someone explain me the concept of Context class/Object. What it is? What it will be used for? Why Context class?

like image 390
Ramesh Avatar asked May 20 '10 02:05

Ramesh


2 Answers

Have you seen the android developer's guide? it will answer your questions:

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.

A Context has a lot of functions, but as a developer, you primarily use it to load and access application resources.

like image 104
YGL Avatar answered Oct 20 '22 16:10

YGL


In programming Android applications, you will hardly ever need to use the Context class directly (not possible at all since Context is abstract), but you will need the child classes that derive from it like Activity, Service etc. You might want to look these up.

like image 34
codinguser Avatar answered Oct 20 '22 16:10

codinguser