Bluetooth data transfer between two Android devices

后端 未结 5 1051
盖世英雄少女心
盖世英雄少女心 2021-02-01 10:19

I have been following this Android guide for Bluetooth communication

To explain exactly what I want to do, when the two devices are paired, two different activities ope

5条回答
  •  庸人自扰
    2021-02-01 10:24

    // Enter code here
    
    Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            byte[] writeBuf = (byte[]) msg.obj;
            int begin = (int)msg.arg1;
            int end = (int)msg.arg2;
    
            switch(msg.what) {
                case 1:
                    String writeMessage = new String(writeBuf);
                    writeMessage = writeMessage.substring(begin, end);
                    break;
            }
        }
    };
    

提交回复
热议问题