Hello. I decided to make a simple application for "learning" English. I am implementing a card system now (i.e. I press a button, a word pops up, I press again - again a new word). But my problem is that when you press a button, the word appears, but it does it once. I clicked once, one word showed, and that’s the end. How many press do not press - violet. Tell me what to do in this situation? PS I apologize for govnokod. Tried a lot of things and nothing helped (
public class Word extends AppCompatActivity { TextView MainTextView; TextView detailed; public int levelint = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_word); MainTextView = findViewById(R.id.TextWordTable); detailed = findViewById(R.id.detailed); } public class WordList { String[] level1 = {"an Apple","a House","a Man","an Apple","a House","a Man","a Xui"}; String[] leveldetal = {"Яблоко","Дом","Мужыг"}; String[] level2 = {"a Boy","A girl","level 3"}; String[] level3 = {"ss","level 2","level 3"}; int step = 0; } public void onClick(View v) { WordList allWord = new WordList(); //for (int i = 0; i < allWord.level1.length; i++) { //MainTextView.setText(allWord.level1[i]); //detailed.setText(allWord.leveldetal[i]); if (levelint == 0) { String disp = new String(allWord.level1[allWord.step]); MainTextView.setText(disp.toString()); allWord.step++; if (allWord.step == 10) levelint++; allWord.step = 0; } else if (levelint == 1) { MainTextView.setText(allWord.level2[allWord.step]); allWord.step++; if (allWord.step == 10) levelint++; allWord.step = 0; } } }