setText is not updating

后端 未结 2 471
长发绾君心
长发绾君心 2021-01-19 01:34

Here is the code and i want to setText the Array of Textview after the random Images selected.. its not updating the textVew. I am passing Context and view to the construct

相关标签:
2条回答
  • 2021-01-19 02:03

    You should call postInvalidate() after setText(...), not in advance !

     ...
     _HudTextDisplay[i].setText(_hiddenObjects[i].getTag().toString());
     _HudTextDisplay[i].postInvalidate();
     ...
    
    0 讨论(0)
  • 2021-01-19 02:13

    for anyone who is having this problem, you may have to place your setText method inside this

        ((Activity) context).runOnUiThread(new Runnable() { 
            @Override
            public void run() {
                ((EditText)editText).setText(text);
            }
        });
    
    0 讨论(0)
提交回复
热议问题