zooter
zooter

Reputation: 2208

Is there a way to have a Resource name inside strings.xml with a space?

Example:

Android complains that ' ' is not a valid resource name character.

Am I forced to use say "New_Delhi" and then programatically map this in my program?

Upvotes: 1

Views: 131

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007322

Yes, for the simple reason that Java fields cannot have spaces in their names. A string resource named New_Delhi is referenced in Java as R.string.New_Delhi. A space, in lieu of the underscore, would not be valid Java syntax.

Upvotes: 1

Related Questions