Tuesday, May 11, 2010

[android-developers] which is better to use to avoid mem leaks==> getbasecontext or getApplicationcontext

public Context getApplicationContext ()

Since: API Level 1

Return the context of the single, global Application object of the current process.


public Context getBaseContext ()

Since: API Level 1
Returns
  • the base context as set by the constructor or setBaseContext
Since applicationcontext is global application object,

To avoid objects retained in memory after activity is closed (assuming this application has lots of activities), its better to use getbasecontext
Is my understanding right.?

Thanks for all your inputs.




--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment