Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

static final String or strings.xml

Tags:

android

What are the rules for using strings.xml resource files versus an interface where String constants would be defined.

I'm assuming that the strings.xml resource file would be used to define non-functional strings to be used for display purposes such as text in various languages, date rendering formats, etc.

And Interface String constants would be used to define regular expression patterns, Intent extras variable name passing definitions, etc.

like image 524
Salsero69 Avatar asked Apr 06 '11 21:04

Salsero69


1 Answers

Correct. The key is that you can translate the strings in strings.xml - anything written in English (or any other language) and will be exposed to the user should be in strings.xml so you can translate it.

Patterns/regexes should be Strings for better performance, unless those regexes are language-specific.

like image 84
EboMike Avatar answered Sep 29 '22 02:09

EboMike