请参阅我已用于runOnUIThread(){}
更新AsyncTask
按钮颜色。更新这些按钮属性后,我可以读取它的颜色、名称等...在日志中,一切都正确显示,但这些属性没有在 UI 中更新。如何解决?
这是我的代码,
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());
}
});