Android - 将数据从 MainActivity 发送到 Thread

Android - Send data from MainActivity to Thread

在我的 Android 应用程序中,我需要将我的 UI 中的任何更改发送到线程。
用户更改了一个文本视图,我需要获取值并发送给线程处理。可能吗?
我只看到从线程到 UI(通过 runOnUiThread)的解决方案,但没有看到从 UI 到线程的解决方案。

你可以写你自己的习惯Thread

public static class MyThread extends Thread{
        Object yourData;
        // write your get/set data
        // override the run function.
}

之后,您可以轻松更改线程。但是,你应该记住你不能重用线程。