Reputation: 8794
My misunderstanding continues ...
Can anyone cite references for the proper use of get*Context()
? I get conflicting recommendations about using getBaseContext()
, getApplicationContext()
and getContext()
and my understanding is that using this
is a convenience to get*Context()
. I would like to study more specifically of what Dalvik is intending its object and access methods.
I had code reviews that changed my calls to getBaseContext()
to getApplicationContext()
, now I am seeing suggestions to use this.
Upvotes: 4
Views: 603
Reputation: 843
http://android-developers.blogspot.co.uk/2009/01/avoiding-memory-leaks.html
Read this article. It describe why we should use getApplicationContext()
rather than Activity's this
This is summary of the article:
In summary, to avoid context-related memory leaks, remember the following:
Upvotes: 1