Merge "WiFiDirectServiceDiscovery: Create a thread for sending message"
am: 1906d9c9e3
Change-Id: I14386351d335428fb185cb387557d24cf378c53a
This commit is contained in:
@@ -65,12 +65,18 @@ public class ChatManager implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void write(byte[] buffer) {
|
||||
public void write(String msg) {
|
||||
byte[] buffer = msg.getBytes();
|
||||
Thread thread = new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
oStream.write(buffer);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Exception during write", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,8 +43,7 @@ public class WiFiChatFragment extends Fragment {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
if (chatManager != null) {
|
||||
chatManager.write(chatLine.getText().toString()
|
||||
.getBytes());
|
||||
chatManager.write(chatLine.getText().toString());
|
||||
pushMessage("Me: " + chatLine.getText().toString());
|
||||
chatLine.setText("");
|
||||
chatLine.clearFocus();
|
||||
|
||||
Reference in New Issue
Block a user