0

I'm building an Android app that can be used for two different purposes, say biking and running. I would like to load the sport-specific keywords given a user's preference. They could be defined in different files, like strings_biking.xml and strings_running.xml .

How can I implement this as efficient/elegant as possible? I've taken a look at locales, styles, themes and lots of other topics in the Android documentation, but nothing seems to fit well enough.

jlhonora
  • 10,179
  • 10
  • 46
  • 70

1 Answers1

0

AFAIK it does not support such distinguish as per category. strings.xml are used for localization only. For your purpose, you can define some prefix/suffix to the string name. While using them in activity, create string runtime by applying that prefix/suffix and string name for biking or running or any other condition.

May be this link can help for dynamic creation of string.

Community
  • 1
  • 1
Ravi Bhatt
  • 1,930
  • 1
  • 14
  • 27