I\'m making a quiz program for android, and to keep things compatible for different languages, I\'ve put all my quiz questions and labels in my strings.xml file. Basically
For those that are interested, I got my code up and running with the following.
public class MainActivity extends AppCompatActivity {
String[] questionHeaders, answerKey, questions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Resources res = getResources();
questionHeaders = res.getStringArray(R.array.question_header_array);
answerKey = res.getStringArray(R.array.answer_key_array);
questions = res.getStringArray(R.array.questions_array);
}
int correctAnswers = 0;
int questionCounter = 0;
onCreate()
.res
inside onCreate()
.getStringArray
on res
to load each String[] array