Why not just use two arrays and put them in your hashmap. There is no hashmap definition in resouce as I know. Sometimes, simple way is the best way.
On Apr 12, 7:55 pm, HippoMan <[email protected]> wrote: > My main reason is that I want to have public static final mapped > values available to a number of classes. This way, I can instantiate > other static final fields using some of the mappings in this HashMap. > I can't do that if I have to decode an XML file at run time. > > If I could dereference R.string.* values via a static method call, I > would be able to directly create a static class containing the > HashMap, as follows: > > public class Static { > public static final Map<String, String> map = new > ConcurrentHashMap<String, String>() {{ > put(X.getString(R.string.string0), > "foo-item"); > put("abc", > X.getString(R.string.string1)); > put(X.getString(R.string.string2), > X.getString(R.string.string3)); > }}; > > } > > ... where "X" is a hypothetical class that could be used to statically > retrieve the R.string.* values. But since I can only access these > strings via a method call off of an instantiated Context object, I'm > out of luck. This is another reason for why I'd like to generate a > public static final HashMap. > > Whether these reasons are considered to be "compelling" is up to the > beholder. > > Given that there appears to be no way to do this using standard > Android facilities, your XSLT suggestion seems to be a good one. > > Thank you very much. > > And yes, I did indeed mean something like @string/string0. -- 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 To unsubscribe, reply using "remove me" as the subject.

