public void run(){
byte[] buffer = new byte[1024]; // buffer store for the stream
int bytes; // bytes returned from read()
while (true) {
// Read from the InputStream
try {
bytes = mmInStream.read(buffer);
String incomingMessage = new String(buffer, 0, bytes);
Log.d(TAG, "InputStream: " + incomingMessage);
Intent incomingMessageIntent = new Intent("IncomingMessage");
incomingMessageIntent.putExtra("theMessage" , incomingMessage);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(incomingMessageIntent);
} catch (IOException e) {
Log.e(TAG, "write: Error reading Input Stream. " + e.getMessage() );
break;
}
}
}
putExtra로 Intent한 incomingMessageIntent에 문자를 넣어주려고 하는데요
Intent 방법이랑 putExtra 방법이 틀렸나요?? 문자가 저장이 안되는거 같네요