1

See I have used runOnUIThread(){} in AsyncTask to update button color. After updating those button attributes I can read its color, name, etc... In Log everything is showing correctly but those properties were not getting updated in UI. How to fix it?

Here is my code,

MainActivity.activity.runOnUiThread(new Runnable()
{
  @Override
   public void run() {
      Log.d("status","Inside Main Thread");
      Log.d("status","Chaning to your turn");
      yourTurn.setText("your turn *");
      oppTurn.setText("");
      Log.d("status","Your turn : " + yourTurn.getText().toString());
      Log.d("status","Your turn boolean : " + isYourTurn);
      Log.d("status","Changing bg color");
      button.getBackground().setColorFilter(0xFFFF0000,PorterDuff.Mode.MULTIPLY);
      Log.d("status","Updating the scores");
      yourScoreView.setText(gamer.getGamerName() + " Score : " + gamer.getYourScore());
      oppScoreView.setText(gamer.getOppName() + " Score : " + gamer.getOppScore());
    }
});
Alistra
  • 5,177
  • 2
  • 30
  • 42

0 Answers0