开发者

send data from a thread to an activity

开发者 https://www.devze.com 2023-03-04 21:35 出处:网络
I\'m creating an app that is a sort of client- multithreaded server. The problem that I\'m facing with is the next one:

I'm creating an app that is a sort of client- multithreaded server.

The problem that I'm facing with is the next one:

The server is multithreaded and that means that it receives the data fr开发者_C百科om the clients in a thread(a separate class which is not a inner class for an activity) and I wanna send that data to a class that extends activity!!!

Is that possible?And if yes,how??

Thank u!

UPDATE:My thread is a Worker thread it implements Runnable and the data needs to ne send to a different class that extends activity!!!


Yes, you can send a Message from the thread back to the Activity using a Handler. This article may be helpful.

0

精彩评论

暂无评论...
验证码 换一张
取 消