0

I've a string array in array.xml:

<string-array name="stringList">
    <item indent="true">Item1</item>
    <item indent="false">Item2</item>
    <item indent="false">Item3</item>
    <item indent="true">Item4</item>
</string-array>

As you've noticed, I need to declare a custom properties for the string (indent). My aim is to generate an HashMap with key = "ItemX" and value = "true/false". Is it possibile to do that in android? Any smarter way? Many thanks in advance.

1
  • Why do you have double "" after the Boolean for the Item 2 to 4 ? Commented Jan 8, 2014 at 9:35

1 Answer 1

2

Just use 2 arrays :)

<string-array name="keys">
    <item>Item1</item>
    <item>Item2</item>
    <item>Item3</item>
    <item>Item4</item>
</string-array>

<string-array name="values">
    <item>true</item>
    <item>true</item>
    <item>false</item>
    <item>false</item>
</string-array>
Sign up to request clarification or add additional context in comments.

3 Comments

Mh, k =) just looking for something more compact.
splitting values is another simple solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.