Difference- ApplicationContext() VS. Activity Context in ANDROID..? -


possible duplicate:
difference between activity context , application context

i want know actual difference between application context , activity context in android..?

these 2 confusing me time. please find me difference two.??

to have gist on application context , activity context read below:

the application context live long application alive , not depend on activities life cycle. if plan on keeping long-lived objects need context, remember application object. can obtain calling context.getapplicationcontext() or activity.getapplication().

in summary, avoid context-related memory leaks, remember following:

1.do not keep long-lived references context-activity (a reference activity should have same life cycle activity itself)

2.try using context-application instead of context-activity

reference & more info


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -