Adding new string arrays

Create a new string array resource using the Localization Files Editor.

  1. Launch the Localization Files Editor using one of the following methods:
    • Double-click res/values/strings.xml (or any of the localized strings.xml files in your project).
    • Right-click res/values/strings.xml (or any of the localized strings.xml files in your project) and select Open With > Other. From the Editor Selection dialog, select Localization Files Editor and click OK.
    The Localization Files Editor appears, showing the base (or default) strings file and any localized strings files.
  2. Right-click anywhere within the Localization Files Editor table and select Add Key. The New Row dialog appears.
  3. From Add new select Array.
  4. Select Add new array, enter the key that will be used to access the new string array, and specify the number of entries in the array.
  5. Click OK.
    A set of new, empty rows are added to the table, one for each array entry, identified by the supplied key with a numeric index added (for instance, "myKey_002"). Although the Android Localization Files Editor shows a set of keys with varying numeric indexes, the underlying XML creates a single <string-array> element with the supplied key that contains the specified number of <item> elements. For example, if you create a string array with the key "myKey" and three entries, the Android Localization Files editor would show three rows with keys "myKey_000", "myKey_001", and "myKey_002" while the corresponding portion of the underlying XML would look like the following:
    <string-array name="myKey">
            <item>the first entry value goes here</item>
            <item>the second entry value goes here</item>
            <item>the third entry value goes here</item>
    </string-array>

    Note that after creating a new string array a warning icon () appears to the left of each key, indicating that the default strings file does not yet have a value defined for these keys.

  6. Enter string values for each key in the appropriate columns. Generally you will enter a default, or base, string in the values column and localized versions of that string in columns for those locales in which the default string is not appropriate. Note that you can enter multi-line string values by pressing the Return key between lines.
  7. Select File > Save to save your changes.
To remove an individual string simply right-click within the row and select Remove Key. To remove a string array you must select each of the rows that makes up the array (click in the first row, and then while holding the shift key click in the last row to select a range), then right-click the selected rows and select Remove Key.
Related tasks
Adding new strings
Editing a localized string array
Related reference
Localization Files Editor
Related information
Which Resources Take Precedence?