Best way to get an Application Context into a static method in Android

Posted by Slapout on Stack Overflow See other posts from Stack Overflow or by Slapout
Published on 2010-05-07T01:43:12Z Indexed on 2010/05/07 1:48 UTC
Read the original article Hit count: 276

Filed under:
|

I'm working on an Android application that has several Activities. In it I have a class with several static methods. I would like to be able to call these methods from the different Activities. I'm using the static methods to load data from an xml file via a XmlResourceParser. To create a XmlResourceParser requires a call on the Application Context. So my question is, what is the best way to get a reference to the Application Context into the static methods? Have each Activity get it and pass it in? Store it somehow in a global variable?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-context