Resources res = getResources(); String apple = res.getString(R.string.word_apple); String girl = res.getString(R.string.word_girl); String man = res.getString(R.string.word_man); String boy = res.getString(R.string.word_boy); String family = res.getString(R.string.word_family); String child = res.getString(R.string.word_child); private String[] questions = {"", girl, man, boy, family, child, apple, ""}; count = 0; 

And the OnClickListener method

  Button butCheck = (Button)findViewById(R.id.button); TextView textView = (TextView)findViewById(R.id.textView); butCheck.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(count<8){ count++; textView.setText(questoins[count]); }else{ Intent intent = new Intent(Activity.this, Second.class); startActivity(intent); } } 
  • And where is ArrayList ??? - m. vokhm
  • What is count ? Where is it initialized? - Suvitruf

1 answer 1

First, I do not see ArrayList here. In the above code, there is only the usual array String[] questions .

Secondly, this code will not compile, because in in line:

 textView.setText(questoins[count]) 

No semicolon.

And thirdly, by pressing the button textView , the corresponding array element will be displayed in the textView only if you change:

 textView.setText(questoins[count]) 

on

 textView.setText(questions[count]); 

Well, also in the above code a lot of problems.