Update the UI with dynamic text

后端 未结 3 1173
一向
一向 2021-01-23 05:49

I wish to update the text on the screen every 5 second, I have created a timer to do so. However after the first update it never updates the box again. I am assuming I need to r

3条回答
  •  情书的邮戳
    2021-01-23 06:31

    runOnUiThread(new Runnable() {  
        public void run() {
            textTitle.setText(title);
        }
    });
    

    You cannot update UI from background thread. Whenever you want to make modifications to UI it is suggested to use UI thread

提交回复
热议问题