You can use the "keys.xml" files in "res / values", but you should put something like this, so you should not have a problem when using multiple languages:
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation"> <string name="key1">key1</string> <string name="key2">key2</string> ... </resources>
Then you can refer to it as a regular string in xml:
.... android:key="@string/key1" ....
or in your java code, for example:
SwitchPreference Pref1= (SwitchPreference) getPreferenceScreen().findPreference(getString(R.string.key1));
Nico Pedraza Mar 27 '16 at 3:54 on 2016-03-27 03:54
source share