Is it a good practice to use application context instead of other context(Activity, Service and so on) if possible? Pros:
Cons:
No clue for me after googling for a while and this is where this question from.
Is it a good practice to use application context instead of other context(Activity, Service and so on) if possible?
Not in general. Use Application
when you know precisely why you are using Application
.
Application context can help us avoid memory leak.
It can also cause memory leaks (creating a custom subclass of Application
and storing things in there). It can also screw up your UI (by ignoring themes), screw up the back stack, etc.
Application context can help eliminate params in some circumstances
I have no idea what you mean by that, sorry.
This blog post by Dave Smith provides an excellent overview of different types of Context
and their roles.