I'm new at Android...I was looking at source code of popular open source android apps like android mail,calendar... and noticed that in each class,service,file...
always passing the Context
parameter and the class initialise it to his local instance of Context
, it almost appears in every class, many times.
My question is why those classes are need to get it as a parameter of their constructor or method while they can get it alone with those methods?
1. getApplicationContext()
2. getContext()
3. getBaseContext()
They can set it in the start and use it...why so many methods in one class getting it? do they get other Context
then those that they can get using on of the 3 methods above?
For example, I saw the Service
is a subclass of a Context class
, so he can basically use this
keyword and not wait for it from the caller.