In my app, I'd like to define some static resources in an xml file
which can be accessed via a HashMap. I know I can do this at run time
in a manner similar to the one which is described here:

http://groups.google.com/group/android-developers/browse_thread/thread/6232ee60944890e8/895415654ccbc21f?lnk=gst&q=hashmap+resources#msg_895415654ccbc21f

However, since my HashMap will be a non-changing resource, I'd like to
precompile my xml into a static HashMap in a manner that is similar to
how the aapt utility precomplies the data in various xml files into
R.java. Furthermore, I'd like the keys and values to be expandable via
the "@+id/item" convention, as follows ...

Suppose the following items exist in strings.xml:

<string name="string0">foo</string>
<string name="string1">bar</string>
<string name="string2">quack</string>
<string name="string3">oink</string>

Then, I would like to be able to do something like this in order to
specify my static HashMap:

<?xml version="1.0" encoding="utf-8"?>
<map name="mymap">
  <element name="@+id/string0">foo-item</element>
  <element name="abc">@+id/string1</element>
  <element name="@+id/string2">@+id/string3</element>
</map>

The resulting generated code in R.java would look something like this:

public static final class map {
    public static final Map<String , String> mymap = new
ConcurrentHashMap<String , String>() {{
        put("foo",      "foo-item");
        put("abc",     "bar");
        put("quack", "oink");
    }};
}

Is there a way to do anything even remotely similar to this under
Android, perhaps using aadb?

Or am I out of luck?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
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.

Reply via email to