Skip to content Skip to sidebar Skip to footer

Textview Showing Strings That Are Not In The Strings.xml When Device Language Is Changed

When I change the device language, strings that are not in the strings.xml are showing in my text view. Below is my text view code:

In your project, right-click res/values/ and select New -> Values resource file. Enter "strings" for the file name and leave the source option set to main. In the Available qualifiers and click ">>" button to move "Locale"to the Chosen qualifiers section. Select the language that you wish to support and select the region (default is: Any region) and left-click "Ok". Android studio will automatically generate a new resource file also called "strings.xml".

Why did I mention that? Android at run time looks for a default string resource. What might be happening is that you're not using a default string resource, instead you're using a 'string-pt' resource, this would be a problem if you don't have resource string file for Spanish or other language.

Solution 2:

if you intend to support other languages when the user changes the default language. you should override string.xml file

create another string.xml (sp) with Spanish as local and add your resource value

<resources><stringname="check_document_image_readable">A foto ficou legível?</string></resources>

to override string.xml with the Spanish version. click on the res folder choose new resource file and name it strings. on the left select local and choose Spanish

Post a Comment for "Textview Showing Strings That Are Not In The Strings.xml When Device Language Is Changed"