Reputation: 22066
What is the difference between:
getApplicationContext()
getBasecontext()
getApplication()
getParent()
Can you elaborate with one simple example?
Upvotes: 98
Views: 57988
Reputation: 11944
getApplicationContext()
Application context is associated with the Application and will always be the same throughout the life cycle.
getBasecontext()
should not be used, just use Context
instead of it which is associated with the activity and can be destroyed when the activity is destroyed.
Upvotes: 37