GreekOphion
GreekOphion

Reputation: 388

Combine Multiple string-array Resources

I have multiple different categories and in each category I use one string resource to populate a ListView like so:

<string-array name="list">
        <item>item1</item>
        <item>item2</item>
        <item>item3</item>
    </string-array>

I call them like so:

String[] list = getResources().getStringArray(R.array.list);

How can I combine these into one String[] to use as an "All" list.

Upvotes: 0

Views: 1540

Answers (1)

K_Anas
K_Anas

Reputation: 31466

you can combine two Array List into a single one Like this:

ArrayList<String> first;
ArrayList<String> second;
second.addAll(first);

Since you use Simple Array there a multiple way to change arrays to arrayList, you can fetch for it on the net. But why you are not storing them on a single array in xml file that you call it global_content for exemple. You are waisting time and memory for this!!

Upvotes: 1

Related Questions