@Override public void onAnimationEnd(Animation animation) { Toast.makeText(PlayQuiz.this, "END", Toast.LENGTH_SHORT).show(); //Show next question showNextQuestion(); mOptionTwoTextView.setText("Hell Yeah"); } private void showNextQuestion() { mThisQuestion = mDummyQuestionList.get(mTHisQuestionID++); //Set Questions and Options mQuestionTextView.setText(mThisQuestion.getQuestion()); mOptionOneTextView.setText(mThisQuestion.getOptionOne()); mOptionTwoTextView.setText(mThisQuestion.getOptionTwo()); mOptionThreeTextView.setText(mThisQuestion.getOptionThree()); mOptionFourTextView.setText(mThisQuestion.getOptionFour()); }
inside the animationEnd the set text works perfectly but after calling this void it should change text but it is not changing text.
Advertisement
Answer
@Override public void onAnimationEnd(Animation animation) { // execute methods in main thread new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { Toast.makeText(PlayQuiz.this, "END", Toast.LENGTH_SHORT).show(); showNextQuestion(); mOptionTwoTextView.setText("Hell Yeah"); } }); }