Which is the correct statement below?


Assume that you have the following situation:

The app code calls for R.string.text_a Three relevant resource files are available:

-res/values/strings.xml, which includes text_a in the app’s default language, in this case English.

-res/values-mcc404/strings.xml, which includes text_a in the app’s default language, in this case English.

-res/values-hi/strings.xml, which includes text_a in Hindi.

The app is running on a device that has the following configuration:

-The SIM card is connected to a mobile network in India (MCC 404).

-The language is set to Hindi (hi).

Which is the correct statement below?
A . Android loads text_a from res/values/strings.xml (in English)
B . Android loads text_a from res/values-mcc404/strings.xml (in English)
C . Android loads text_a from res/values-hi/strings.xml (in Hindi)

Answer: B

Explanation:

Android loads text_a from res/values-mcc404/strings.xml (in English), even if the device is configured for Hindi. That is because in the resource-selection process, Android prefers an MCC match over a language match (as a priority Exception).

Reference: https://developer.android.com/guide/topics/resources/localization

Leave a Reply

Your email address will not be published.