if i understand correctly, you use getContext()
to get the context of a view object. You use activity context or this
if you want to create a new object that exist as long as activity exist, if not the activity wont be destroyed and eventually lead to memory leaks. You use getApplicationContext()
if you want a context that is tied to the global lifecycle of the application and should be used wherever we need to create a object that exist beyond the current activity.
Is my understanding correct ?
But what is getBaseContext()
and where do you use it exactly.. One simple and solid example would be great