0

How do I store this 2 Dimensional array in strings.xml?

private String[][] children = { { "Arnold", "Barry", "Chuck", "David" }, { "Ace", "Bandit", "Cha-Cha", "Deuce" }, { "Fluffy", "Snuggles" }, { "Goldy", "Bubbles" } }; 

1 Answer 1

1

Your usage case would help answer the question, because depending on your situation, my suggestion would be to put the individual Strings in strings.xml and then use an int[][] inside your class pointing to the string resources:

private final int[][] children = { { R.string.arnold, R.string.barry, R.string.chuck, R.string.david }, { R.string.ace, R.string.bandit /*etc*/ } // etc // ... }; 

I know that doesn't directly answer your question as to how to do that in XML, but unless you provide a usage case that makes it clear that it's necessary to do that, there's no reason to do anything harder than what I've described.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I am using the strings in an expandable list.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.