Code example for BluetoothSocket

Methods: getInputStream, getOutputStream

0
            InputStream tmpIn = null;
            OutputStream tmpOut = null;
 
            // Get the BluetoothSocket input and output streams 
            try { 
                tmpIn = socket.getInputStream();
                tmpOut = socket.getOutputStream();
            } catch (IOException e) {
                Log.e(TAG, "temp sockets not created", e);
            } 
            mmInStream = tmpIn;
            mmOutStream = tmpOut;
        } 
 
        public void run() { 
            if (mmSocket == null || mmInStream == null) {
                Log.e(TAG, "Input stream or socket is null. Aborting thread");
                return; 
            } 
            if (D) Log.d(TAG, getId() + ":BEGIN mConnectedThread");
            java.util.Arrays.fill(buffer, (char) ' ');