mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-01 18:31:45 +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,12 +66,19 @@ public class TcpClient {
|
|||
*
|
||||
* @param message text entered by client
|
||||
*/
|
||||
public void sendMessage(String message) {
|
||||
if (mBufferOut != null) {
|
||||
Log.d(TAG, "Sending: " + message);
|
||||
mBufferOut.println(message + "\r\n");
|
||||
mBufferOut.flush();
|
||||
}
|
||||
public void sendMessage(final String message) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mBufferOut != null) {
|
||||
Log.d(TAG, "Sending: " + message);
|
||||
mBufferOut.println(message + "\r\n");
|
||||
mBufferOut.flush();
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread thread = new Thread(runnable);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue