I have a problem with receiving data via BT, sent from SPP BT module. When I'm sending bytes from terminal i got non-sense characters - for example "[B@420e98d8". There is a part of the code from handler responsible for data receive:
mHandler = new Handler(){
public void handleMessage(android.os.Message msg){
if(msg.what == MESSAGE_READ){
try {
byte[] readBuf = (byte[]) msg.obj;
byte[] bytes = (msg.obj).toString().getBytes();
mReadBuffer.setText(readBuf.toString());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
if(msg.what == CONNECTING_STATUS){
if(msg.arg1 == 1)
mBluetoothStatus.setText("Connected to Device: " + (String)(msg.obj));
else
mBluetoothStatus.setText("Connection Failed");
}
}
};
How should I convert received values to display them properly? Or how to receive this otherwise? I don't need to use BLE, normal Bluetooth module, programming in Android Studio 2.2.3.