I've created a set of handy xml parsers for the preferences file
(R.xml.preferences) and created a class called PrefrencesHelper. This
worked fine when the class was in the main project. But I want to
share PrefrencesHelper as a library.

In the non-lib version, I instantiate the parser like this inside each
PrefrencesHelper method:

XmlResourceParser parser = getResources().getXml(R.xml.preferences);

So there is always a fresh instance of the pull parser when I want to
parse something out.

But that's not going to work in a lib where the R class I want is in
the main project. The local library R class won't contain
R.xml.preferences.

I see two options. Maybe you folks can help me think of a third,
better way:

1) Instantiate a fresh parser in the main project whenever I call a
PrefrencesHelper method and include that as one of the arguments. This
is really messy and I want to avoid it at all costs.

2) Instantiate the parser once in the main project and pass it to the
PrefrencesHelper constructor. But if I do this, I need to figure out a
way to "rewind" the parser and make it start from the beginning of the
file with each PrefrencesHelper method call. I haven't found any easy
way to do that.

Any ideas?


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

Reply via email to