Chapter 2: pg 42, listing 2.7 question


In listing 2.7, page 42, why is question an int?

int question=mQuestionBank[mCurrentIndex].getTextResId();



Because it is assigned to something (the following getTextResId() method) that returns a number. Question in this case is not a string, but rather a reference id number. The reference id is correlated with a string, which is in turn the question text that we see on the application.

Kind of reminds me how an IP address, which is a number, is also correlated with a URL, which is a string.


When I write this code, my application Crashes.
I turned this into mQuestionTextView.setText(Integer.toString(question)); and it shows 0 but not the question text.
Any solution ?