tags:

views:

6579

answers:

1

Is there a way to get the current Context instance by using a static method?

I'm looking for that way because i hate saving the context instance each time it changes.

Bests :)

+5  A: 

No, I don't think there is. Unfortunately, you're stuck calling getApplicationContext() from Activity or one of the other subclasses of Context. Also, this question is somewhat related.

Erich Douglass
Also, there is a good article on the Android Developers' site about avoiding memory leaks by ensuring you use the appropriate `Context` objects: http://developer.android.com/resources/articles/avoiding-memory-leaks.html
Christopher