mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-07 05:11:43 +02:00
keep TcpClient calls off the main thread
This commit is contained in:
parent
920d88ce59
commit
eb710bd91f
1 changed files with 13 additions and 6 deletions
|
@ -66,13 +66,20 @@ public class TcpClient {
|
||||||
*
|
*
|
||||||
* @param message text entered by client
|
* @param message text entered by client
|
||||||
*/
|
*/
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(final String message) {
|
||||||
|
Runnable runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
if (mBufferOut != null) {
|
if (mBufferOut != null) {
|
||||||
Log.d(TAG, "Sending: " + message);
|
Log.d(TAG, "Sending: " + message);
|
||||||
mBufferOut.println(message + "\r\n");
|
mBufferOut.println(message + "\r\n");
|
||||||
mBufferOut.flush();
|
mBufferOut.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
Thread thread = new Thread(runnable);
|
||||||
|
thread.start();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the connection and release the members
|
* Close the connection and release the members
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue