I\'m having problem getting a string array for strings.xml .
The error is:
android.content.res.Resources$NotFoundException: String array resource ID
Make sure you don't have variants of the values
resources, with the string array defined only for a subset of the variants. For example:
values-v21/strings.xml - defined
values/strings.xml - not defined
If the resource is present in at least one variant, you get the entry in R
and can refer to it in code, but the runtime resource file variant does not necessarily have the resource.
I also have the same error. I simply Invalidated caches and restart android studio and everything works fine then. To Invalidated caches and restart Goto Files > Invalidate Caches/restart. This is some sort of bug of the android studio it happens to me several times.
I got this error because I used TextView.setText(int)
to set a number in the text. The problem is that Android thinks that the integer is a ressource id. Therefore I should encapsulate the interger inside of String.valueOf(int)
so the code becomes TextView.setText(String.valueOf(int));
in my case
array.xml
was in w820dp
version.
i just created another in values.xml
without w820dp
.
Works!!!
Do this to render Integer to textview
TextView.setText(String.valueOf(int));
I solve the problem. Juste create a values/strings.xml file with all your string values define in values-v21/strings.xml.