When I try to get all references into array I get error. Failed adding to JNI local ref table (has 512 entries).
I try to read all strings into Array like:
String[] aStrings = mAppContext.getResources().getStringArray(R.array.a_array)
in xml i have 500+ lines of strings, like:
<string-array name="a_array">
<item>0@100@Name1</item>
<item>1@101@name2</item>
...
...
...
<item>600@101@name600</item>
</string-array>
If i run my code in for exemple note2(4.+) everything works ok, if I run it in wildfire(2.+) I get error. If i reduce entries bellow 500 then everything works ok. I belive that error that I get is because of low memory on older device. When error happens applicatin crash.
Now I got two questions:
- can I avoid this error? somehow fix this? so that my app woun't crash.
- is there a way to catch this error and load smaller array? (I tryed with try catch block, but no success)