Here are reasons why not to use getApplicationContext() wherever you go:
- It’s not a complete
Context, supporting everything thatActivitydoes. Various things you will try to do with thisContextwill fail, mostly related to the GUI. - It can create memory leaks, if the
ContextfromgetApplicationContext()holds onto something created by your calls on it that you don’t clean up. With anActivity, if it holds onto something, once theActivitygets garbage collected, everything else flushes out too. TheApplicationobject remains for the lifetime of your process.
See this table as a guidance for when to use the different types of Context: