I'm wondering what the difference between all those methods:
getApplication(), getApplicationContext(), getActivity()
is.
I use it fairly often for toasts and stuff but only know which one to choose because
of the IDE-help.
Asked
Active
Viewed 859 times
0

Philip
- 1,068
- 3
- 12
- 21
-
1http://stackoverflow.com/questions/5018545/getapplication-vs-getapplicationcontext might help you – Anthony Raymond Mar 31 '14 at 19:22
-
1this is the best explanation so far http://stackoverflow.com/questions/7298731/when-to-call-activity-context-or-application-context – Matej Špilár Mar 31 '14 at 19:31
1 Answers
1
You should rather try to understand what is the difference between Application, Activity and Context. All the 3 concepts are well documented in the Android official documentation.
To be fair, the meaning of context is not so clear from the documentation, so here is a short explanation and here is a long one