I try to follow the example on the Andoid developers page in order to implement a string array from string resoirces. It doesn't work.
The following line of code in my MainActivity
(right at the top of the class) is throwing an runtime exception error:
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
Resources res = getResources();
String[] fortuneStrings = res.getStringArray(R.array.fortuneStringArray);
...
I checked everything but I do not know how else to debug. Any help? Thanks.
1. Edit
here is my string.xml
<resources>
<string-array name = "fortuneStringArray">
<item>blabla1</item>
<item>blabla2</item>
<item>blabla3</item>
<item>blabla4</item>
</string-array>
</resources>