use getTextArray, it returns CharSequence[] instead of String[] which preserves attached spans
Spannable array from string resource
-
25-06-2023 - |
Вопрос
Is there a way to extract a Spannable[] stuff
from string resource? Basically something similar to
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="planets_array">
<item>Welcome to <b>Mercury</b></item>
<item>Welcome to <b>Venus</b></item>
<item>Welcome to <b>Earth</b></item>
<item>Welcome to <b>Mars</b></item>
</string-array>
</resources>
Then I would extract the array into
Resources res = getResources();
Spannable[] planets = res.getStringArray(R.array.planets_array);
But right now eclipse is telling me to change Spannable[]
to String[]
.
Решение
Не связан с StackOverflow