Text List to Android string-array XML

Paste one item per line and get a ready-to-use Android resource block.

Runs entirely in your browser. Nothing you enter is sent or stored.

How to use

  1. Enter the array name used in R.array.
  2. Paste your list, one item per line.
  3. Copy the XML or download it as arrays.xml.
  4. Put it under res/values/ in your Android project.

When an Android app needs a fixed list — countries, categories, spinner options — the usual place is a <string-array> in res/values. Typing <item> tags by hand for dozens of entries is tedious, and one stray apostrophe can break the build. This converter turns a plain text list, one entry per line, into a complete <resources> block you can paste into strings.xml or save as arrays.xml.

Each line is trimmed, empty lines are dropped, and lines starting with "[source" are skipped. For string-array and array, the characters & < > are written as XML entities, backslash, apostrophe and double quote get a backslash, and an item that starts with @ or ? is escaped so it is not read as a resource reference. The array name keeps only letters, digits and underscores, and a leading digit gets an underscore in front. In code you read it with getResources().getStringArray(R.array.name), or getIntArray for an integer-array.

Limits: integer-array items are copied as typed and not checked, so make sure each line is a whole number. Format placeholders such as %s or %d are left unchanged. The text you paste is processed only in this browser and is never sent or saved.

Frequently asked questions

Are apostrophes and quotes escaped?

Yes. Characters such as ' " & < > and a leading @ or ? are escaped so aapt compiles the resource without errors.

Which lines are skipped?

Empty lines and lines starting with "[source" are skipped, and every line is trimmed.

Can I make an integer-array?

Yes. Choose integer-array in the type menu.

Related tools