0

can I change the referring a resource folders programmaticaly. I need to use a language that is not supported by android, in my case Sinhala. can I create a values_sin folder and refer it when user select Sinhala language. can I change the font together with that for entire application.

Shyam
  • 6,376
  • 1
  • 24
  • 38
Samantha Withanage
  • 3,811
  • 10
  • 30
  • 59

1 Answers1

0

How about this: put your Sinhala strings in res/values/strings.xml, and the English strings in res/values-en/strings.xml or maybe even better, in res/values-en-rIN/strings.xml. When using the second method, your app will be in English only if the user selects "English (India)" as the phone's language. In any other case, the default resources will be used - which in your case will be in Sinhala!

Edit 2: actually, Android does support Sinhalese, using res/values-si. If you can't select Sinhalese as your device's default language, you could change it at runtime. There are plenty of posts already, such as Changing Locale within the app itself

Community
  • 1
  • 1
jclehner
  • 1,440
  • 10
  • 18