What is Context?
Read about Context in Android
Literal meaning of context
The circumstances that form the setting for an event, statement, or and idea and in terms of which it can be fully understood.
The Context tells us about the surrounding information
It is very important to understand the environment which we wnat to understand
We can break Context and its uses into three major parts
- It allows us to access resources
- It allows us to interact with other Android components by sending messages
- It gives you information about your app environment
Types of Context(Only important one)
- Application Context
- Activity Context
Application Context
# Tied to the lifecycle of the application
# This is Singleton Instance
# Load resource value
# Start and Bind to the Service
# Send a Broadcast
# Register Broadcast receiver
Activity Context
# Tied to the lifecycle of the Activity
The benefit of using “ContextWrapper” is that it lets you to modify behaviour without changing the original context