Hi. I have a question about how to get the XML string array items into a Java string[] array.
This is what I have:
This seems correct. When I try to run this in the emulator I get an error dialog. Take this out and run a simple "QuesView.setText("any old string") and it runs.
I tried to debug it. I have to say I can't get my head around the debugger. I couldn't see an error message or stack trace anywhere.
A long time ago I used to use Textpad to do all my Java (which wasn't very much). If it had an error, I looked at the stack trace and fixed it. Anyway, rant over, can anyone give me a hint why this doesn't work?
This is what I have:
Code:
private String[] rbarray;
private Random random;
...
...
...
rbarray =res.getStringArray(R.array.Questions);
randint = random.nextInt(2);//so far I only have two items in the strin-array
String question = rbarray[randint];
QuesView.setText(question);
This seems correct. When I try to run this in the emulator I get an error dialog. Take this out and run a simple "QuesView.setText("any old string") and it runs.
I tried to debug it. I have to say I can't get my head around the debugger. I couldn't see an error message or stack trace anywhere.
A long time ago I used to use Textpad to do all my Java (which wasn't very much). If it had an error, I looked at the stack trace and fixed it. Anyway, rant over, can anyone give me a hint why this doesn't work?