Accessing views from other thread (Android)

前端 未结 5 1022
小蘑菇
小蘑菇 2020-12-19 07:21

I\'m developing an android application, and I have a button which starts/pauses certain simulation process. While this process is running, I need to output some data from it

5条回答
  •  盖世英雄少女心
    2020-12-19 07:41

    you have to store the data which you are wanting do show into a public var and let your Thread call a Runnable via Handler.post(runnable) The code in the run() method of the Runnable is able to access the Textview

提交回复
热议问题