Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - can not get resources from XML
    text
    copied!<p>Android - get resources from <code>XML</code></p> <p>Hi,</p> <p>I am developing an android app for a quiz game, the game has 24 questions, and each question has a <code>String</code>(question) and four ImageButton<code>(answer), when user select the correct</code>ImageButton`, then they go to next question. </p> <p>But the problem is, after selecting the first correct answer, the screen refreshes with a new question and a new set of images, but it freezes there, and no matter what I click, it will not go to next question. I have attached my code and any help appreciated!!</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_game); // set variables int fourImageId[] = { R.id.1_4a, R.id.1_4b,R.id.1_4c, R.id.1_4d }; questionText = (TextView) findViewById(R.id.question1); questionList = getResources().getStringArray(R.array.question); correctAnswerIdList = ListOfImages.getListOfCorrectImages(); imageIdList = ListOfImages.getListOfImages(); //two dimension array // give values to four image buttons for (int i = 0; i &lt; 4; i++) { fourImages[i] = (ImageButton) findViewById(fourImageId[i]); final int temp = fourImageId[i]; fourImages[i].setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (temp==correctAnswerIdList[index]){ questionText.setText(questionList[index]); for (int i = 0; i &lt; imageIdList[index].length; i++) { fourImages[i].setImageResource(imageIdList[index][i]);} index++; } } });} </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload