Alex Rivera | Logout

Using getResources() in non-activity class

Asked 2011-10-05T19:26:54.693
136

I am trying to use getResources method in a non-activity class. How do I get the reference to the "resources" object so that I can access the xml file stored under resources folder?

Example:

XmlPullParser xpp = getResources().getXml(R.xml.samplexml);
Edit
Report

1 Answer

3

this can be done by using

context.getResources().getXml(R.xml.samplexml);
answered 2012-07-30T09:38:16.367

Your Answer