Answer the question
In order to leave comments, you need to log in
Changing interface from another thread?
The interface is a button and a textView. When the button is pressed, a new thread is created in which a socket is created and receives and transmits data.
How do I pass this string as text to this textView? Throws an exception that I can only use the interface on the thread it was created on.
Answer the question
In order to leave comments, you need to log in
runOnUiThread in activity.
Still smoking Handler.
Back in 2019, it’s not customary in Android to create a thread like this. Use JobManager or Foreground Service with separate thread pool.
You can also take Rx, just in case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question