public void run() {
Log.i(TAG, "BEGIN mConnectedThread");
byte[] buffer = new byte[1024];
int bytes;
// Keep listening to the InputStream while connected
while (true) {
try {
// Read from the InputStream
String mmm = "";
while(mmm.length() < 28) {
bytes = mmInStream.read(buffer);
mmm = mmm.concat(new String(buffer,0,bytes));
if(mmm.length() > 28) {
String kkk = mmm;
Log.d("kkkck", kkk);
}
}
} catch (IOException e) {
Log.e(TAG, "disconnected", e);
connectionLost();
// Start the service over to restart listening mode
BluetoothChatService.this.start();
break;
}
}
}
bluetoothchatservice.java 소스 일부입니다. 여기서 string kkk를 mainactivity.java로 보내서 textview로 출력해야합니다.
그런데 제가 왕초보라 handler를 어떻게 사용해야 할지 모르겠어요.. 제발 도와주세요..