Update Android UI from a thread in another class

前端 未结 3 661
轮回少年
轮回少年 2021-02-11 01:01

I\'ve seen a few questions on here asking similar questions, but I\'ve not yet seen a suitable answer. Many people have asked how to update the UI from a thread, but they\'re al

3条回答
  •  [愿得一人]
    2021-02-11 01:40

    Use the runOnUiThread(Runnable) method to run something on the Main thread and call the ClassName.View.invalidate() method if it is a view or just make a public method in you're Target class which handles the refreshing of the UI.

提交回复
热议问题