What is Context and how does it help? http://forums.bignerdr


Hi fellas,

I have the question as in the subject line, I had this doubt while I was going through the singleton model layer class CrimeLab on page 171, can anyone give me an example idea of how context works in other ways…

**PS: I have the understanding that context helps the non android (or watever) classes to take advantage of starting an activity from them using the context, if this is right, can anyone quote an example code or if wrong…please correct me, but speak “code” thanks ! :slight_smile:) posting.php?mode=post&f=406#


It sounds like your question is generally what a Context is?

Your question is broad, but not an uncommon one. In short, a Context is a binding to the Android environment. Without a context, you can’t get at anything Android - that means you can’t start up an activity (Android is responsible for that), you can’t access any resources (Android knows where those live), you can’t find out about other packages in the system (this information is managed by Android).

It is extremely common for components in Android to require a Context to work. And many are the Android programmers who have lamented the day when they found themselves stranded without one.

Let me know if you have any other questions.


:smiley: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley: Thanks for that clarification, I will have mor equestions coming up and if you are involved in the production of BNR Android book…KUDOS :slight_smile:) Love it :geek: :mrgreen: